use Added Illuminate\Support\Str;

And then ran $name through Str::studly() as $this->module->has() was always returning false.