faithgen /
laravel-sdk
| 1 | <?php |
||
| 2 | |||
| 3 | namespace FaithGen\SDK\Providers; |
||
| 4 | |||
| 5 | use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider; |
||
| 6 | use Illuminate\Support\Facades\Auth; |
||
| 7 | |||
| 8 | final class AuthServiceProvider extends ServiceProvider |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * The policy mappings for the application. |
||
| 12 | * |
||
| 13 | * @var array |
||
| 14 | */ |
||
| 15 | protected $policies = []; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * Register services. |
||
| 19 | * |
||
| 20 | * @return void |
||
| 21 | */ |
||
| 22 | public function register() |
||
| 23 | { |
||
| 24 | // |
||
| 25 | } |
||
| 26 | |||
| 27 | /** |
||
| 28 | * Bootstrap services. |
||
| 29 | * |
||
| 30 | * @return void |
||
| 31 | */ |
||
| 32 | public function boot() |
||
| 33 | { |
||
| 34 | if (request()->headers->has('x-user-key')) { |
||
| 35 | $user_id = request()->headers->get('x-user-key'); |
||
| 36 | Auth::guard('web')->loginUsingId($user_id); |
||
| 37 | } |
||
| 38 | |||
| 39 | if (! config('faithgen-sdk.source')) { |
||
| 40 | Auth::viaRequest('api-key', function ($request) { |
||
|
0 ignored issues
–
show
|
|||
| 41 | $api_key = request()->headers->get('x-api-key'); |
||
| 42 | $class = config('auth.providers.ministries.model'); |
||
| 43 | |||
| 44 | return $class::whereHas('apiKey', function ($apiKey) use ($api_key) { |
||
| 45 | return $apiKey->where('api_key', $api_key); |
||
| 46 | })->first(); |
||
| 47 | }); |
||
| 48 | } |
||
| 49 | } |
||
| 50 | } |
||
| 51 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.