Issues (6)

app/Providers/AuthServiceProvider.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace App\Providers;
4
5
use App\User;
0 ignored issues
show
The type App\User 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. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use Illuminate\Support\ServiceProvider;
7
8
class AuthServiceProvider extends ServiceProvider
9
{
10
    /**
11
     * Register any application services.
12
     *
13
     * @return void
14
     */
15
    public function register()
16
    {
17
        //
18
    }
19
20
    /**
21
     * Boot the authentication services for the application.
22
     *
23
     * @return void
24
     */
25
    public function boot()
26
    {
27
        // Here you may define how you wish users to be authenticated for your Lumen
28
        // application. The callback which receives the incoming request instance
29
        // should return either a User instance or null. You're free to obtain
30
        // the User instance via an API token or any other method necessary.
31
32
        $this->app['auth']->viaRequest('api', function ($request) {
33
            if ($request->input('api_token')) {
34
                return User::where('api_token', $request->input('api_token'))->first();
35
            }
36
        });
37
    }
38
}
39