diff --git a/src/GatesServiceProvider.php b/src/GatesServiceProvider.php index c423c59..efc5ea2 100644 --- a/src/GatesServiceProvider.php +++ b/src/GatesServiceProvider.php @@ -39,14 +39,12 @@ protected function loadGates() $files = ! empty($paths) ? (new Finder)->in($paths)->files() : []; - $namespace = $this->app->getNamespace(); - collect($files) - ->map(function ($file) use ($namespace) { - return $namespace.str_replace( + ->map(function ($file) { + return str_replace( ['/', '.php'], ['\\', ''], - Str::after($file->getPathname(), realpath(app_path()).DIRECTORY_SEPARATOR) + Str::ucfirst(Str::after($file->getPathname(), realpath(base_path()).DIRECTORY_SEPARATOR)) ); }) ->merge(config('gates.classes'))