Mawunyo
1 month ago

Laravel Passpost with multi auth

Posted 1 month ago by Mawunyo

Hi every one

How can I manage laravel API Passport with multi auth

'guards' => [
    'patient' => [
        'driver'   => 'session',
        'provider' => 'patients',
    ],

    'doctor' => [
        'driver'   => 'session',
        'provider' => 'doctors',
    ],

    'clinic' => [
        'driver'   => 'session',
        'provider' => 'clinics',
    ],

    'web' => [
        'driver' => 'session',
        'provider' => 'users',
    ],

    'api' => [
        'driver' => 'passport',
        'provider' => 'users',
        'hash' => false,
    ],

In route/api.php

Route::middleware('auth:api')->get('/user', function (Request $request) { return $request->user(); });

Route::group(['prefix' => 'clinic', 'namespace' => 'Clinic'], function() { Route::apiResources(['doctor' => 'API\DoctorController']); Route::apiResources(['doctorspeciality' => 'API\SpecialityController']); });

Please sign in or create an account to participate in this conversation.