Skip to content

Commit

Permalink
Merge pull request #2 from fmfernandes/master
Browse files Browse the repository at this point in the history
Add support to any location of Policies
  • Loading branch information
dbpolito authored Sep 16, 2020
2 parents d2c0604 + ed8565d commit 9ac22e8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/GatesServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
Expand Down

0 comments on commit 9ac22e8

Please sign in to comment.