1 | <?php |
||||
2 | |||||
3 | namespace ArcherZdip\LaravelApiAuth\Providers; |
||||
4 | |||||
5 | use Illuminate\Routing\Router; |
||||
0 ignored issues
–
show
|
|||||
6 | use Illuminate\Support\ServiceProvider; |
||||
0 ignored issues
–
show
The type
Illuminate\Support\ServiceProvider was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||||
7 | use ArcherZdip\LaravelApiAuth\Console\Commands\PutAppAuth; |
||||
8 | use ArcherZdip\LaravelApiAuth\Console\Commands\ListAppAuth; |
||||
9 | use ArcherZdip\LaravelApiAuth\Console\Commands\GenerateAppAuth; |
||||
10 | use ArcherZdip\LaravelApiAuth\Http\Middleware\AuthorizeApiKeyMiddleware; |
||||
11 | |||||
12 | class ApiAuthServiceProvider extends ServiceProvider |
||||
13 | { |
||||
14 | /** |
||||
15 | * Bootstrap the application services. |
||||
16 | * |
||||
17 | * @return void |
||||
18 | */ |
||||
19 | public function boot(Router $router) |
||||
20 | { |
||||
21 | if (function_exists('config_path')) { |
||||
22 | $this->publishes([ |
||||
23 | __DIR__ . '/../config/apikey.php' => config_path('apikey.php'), |
||||
24 | ], 'config'); |
||||
25 | } |
||||
26 | |||||
27 | if (function_exists('database_path')) { |
||||
28 | $this->publishes([ |
||||
29 | __DIR__ . '/../../database/migrations/' => database_path('/migrations') |
||||
30 | ]); |
||||
31 | } |
||||
32 | |||||
33 | $this->registerMiddleware($router); |
||||
34 | } |
||||
35 | |||||
36 | /** |
||||
37 | * Register the application services. |
||||
38 | * |
||||
39 | * @return void |
||||
40 | */ |
||||
41 | public function register() |
||||
42 | { |
||||
43 | $this->commands([ |
||||
44 | GenerateAppAuth::class, |
||||
45 | ListAppAuth::class, |
||||
46 | PutAppAuth::class, |
||||
47 | ]); |
||||
48 | } |
||||
49 | |||||
50 | /** |
||||
51 | * Register middleware |
||||
52 | * |
||||
53 | * Support added for different Laravel versions |
||||
54 | * |
||||
55 | * @param Router $router |
||||
56 | */ |
||||
57 | protected function registerMiddleware(Router $router) |
||||
58 | { |
||||
59 | $versionComparison = version_compare(app()->version(), '5.4.0'); |
||||
0 ignored issues
–
show
The function
app was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
60 | |||||
61 | if ($versionComparison >= 0) { |
||||
62 | $router->aliasMiddleware('auth.apikey', AuthorizeApiKeyMiddleware::class); |
||||
63 | } else { |
||||
64 | $router->middleware('auth.apikey', AuthorizeApiKeyMiddleware::class); |
||||
65 | } |
||||
66 | } |
||||
67 | } |
||||
68 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths