samedi 23 janvier 2021

How to redirect to customer login page in laravel

I have developed multiauth system with laravel . And I have implemented middleware on routes.

auth is for admin and auth:customer for customer login. i have implemented these middlewares on routes. so now what I want is on customer route if customer is is not logged in it should redirect on customer login but currently it is redirecting on admin login.

customer routes

Route::group(['middleware' => ['auth:customer']], function () {

    Route::get('/customer-read-notification', function () {
        Auth::guard('customer')->user()->unreadNotifications->markAsRead();
        return 1;
    });
   });

admin routes

Route::group(['middleware' => ['auth']], function () {
    Route::get('/staff-read-notification', function () {
        Auth::user()->unreadNotifications->markAsRead();
        return 1;
    });
 });


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire