dimanche 14 juillet 2019

Route login not defined (Multi-auth)

I have problem with multi-auth. Postman says error:

problem:

Route [login] not defined.

I understand it doesn't know which one to route?

I try to make laravel passport api so I dont need any automatic redirections.. I try to create multi-auth.

Like Admins, Stylists, Freelancers, clients..

Every route have own login and registration and other routes..

I tryed to ungroup but this isn't good solution..

Route::group(['middleware' => ['json.response']], function () {

    Route::get('/freelancer/{profile}', 'API\FreelancerController@profile'); // Guests can also see profiles..

    Route::group(['prefix' => 'admin', 'namespace' => 'API', 'middleware' => 'auth:admin'], function() {
        Route::post('/login', 'AdminController@login');
    });
    Route::group(['prefix' => 'freelancer', 'namespace' => 'API', 'middleware' => 'auth:freelancer'], function() {
        Route::post('/login', 'LoginRegisterController@login');
        Route::post('/register', 'LoginRegisterController@freelancerRegister');
    });

    Route::group(['prefix' => 'stylist', 'namespace' => 'API', 'middleware' => 'auth:stylist'], function() {
        Route::post('/login', 'LoginRegisterController@login');
        Route::post('/register', 'LoginRegisterController@stylistRegister');
    });

    Route::group(['prefix' => 'client', 'namespace' => 'API', 'middleware' => 'auth:client'], function() {
        Route::post('/login', 'ClientController@login');
        Route::post('/register', 'ClientController@clientRegister');
    });
});

If I'm http://api.mywebsite.com/freelancer/register then I can register freelancer account..

Or If I'm http://api.mywebsite.com/admin/login then I can only login to admin dashboard.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire