Search
 
SCRIPT & CODE EXAMPLE
 

PHP

Laravel how to use @auth and @guest with multi authentication

//First of all for example you can check admin guards guess like this;

@guest('admin')
    <li class="nav-item">
            <a class="nav-link" href="{{ route('auth.signin') }}">Login</a>
    </li>
    <li class="nav-item">
            <a class="nav-link" href="{{ route('auth.signup') }}">Sign Up</a>
    </li>
@endguest
  
//But i recommend this one, you can check each guard and include a partial for that guards;

@if (Auth::guard('admin')->check())
  @include('admin.auth-links')
@elseif(Auth::guard('supervisor')->check())
  @include('supervisor.auth-links')
@elseif(Auth::guard('instructor')->check())
  @include('instructor.auth-links')
@else
  @include('auth-links')
@endif

// Logout link can be single endpoint which logouts multiple guards.
Comment

Laravel how to use @auth and @guest with multi authentication

@if (Auth::guard('admin')->check())
  @include('admin.auth-links')
@elseif(Auth::guard('supervisor')->check())
  @include('supervisor.auth-links')
@elseif(Auth::guard('instructor')->check())
  @include('instructor.auth-links')
@else
  @include('auth-links')
@endif

// Logout link can be single endpoint which logouts multiple guards.
Comment

Laravel how to use @auth and @guest with multi authentication

@guest('admin')
    <li class="nav-item">
            <a class="nav-link" href="{{ route('auth.signin') }}">Login</a>
    </li>
    <li class="nav-item">
            <a class="nav-link" href="{{ route('auth.signup') }}">Sign Up</a>
    </li>
@endguest
Comment

PREVIOUS NEXT
Code Example
Php :: how to update dropdown value in laravel 
Php :: create table laravel give name table 
Php :: download html table to excel 
Php :: twig url 
Php :: drop column laravel migration 
Php :: laravel rules 
Php :: laravel property 
Php :: with relation laravel 
Php :: laravel request query logger 
Php :: password_verify 
Php :: send data to api php 
Php :: wordpress website redirecting to install page after migration 
Php :: Alternatives to chmod 775 or 664 
Php :: data XML 
Php :: download file from s3 using laravel 
Php :: php get non unique values from array 
Php :: enset laravel session 
Php :: laravel create multiple request 
Php :: SymfonyStyle 
Php :: another query to get user details 
Php :: Display random custom content in WooCommerce shop archive loop 
Php :: spatie/laravel-health 
Php :: random record get with pagination in karavel 8 
Php :: direct without public laravel 
Php :: razorpay refund laravel 
Php :: php executor 
Php :: To fetch the soft deleted user, you should use withTrashed 
Php :: How to use Live web server chrome extension with Laravel 
Php :: phpunit run group 
Php :: php hide credit card middle numbers 
ADD CONTENT
Topic
Content
Source link
Name
6+5 =