Search
 
SCRIPT & CODE EXAMPLE
 

PHP

get the user detail inside the constructor Laravel

public function __construct(){      
    $this->middleware(function ($request, $next) {      
        if(auth()->user()->hasRole('frontuser')){
            return redirect()->route('home')->withFlashMessage('You are not authorized to access that page.')->withFlashType('warning');
        }
        return $next($request);
    });
}
Comment

PREVIOUS NEXT
Code Example
Php :: php 2 decimal even if not exists 
Php :: Add to cart, link to product page 
Php :: install php7 
Php :: laravel 8 livewire tutorial 
Php :: s how to store jwt in http cookie laravel 
Php :: make model factory and controller laravel 
Php :: livewire calendar for laravel 9 
Php :: phpmail headers 
Php :: Uncaught RedisException: Redis server went away in 
Php :: find the next 7 date data in laravel eloquent 
Php :: phpunit test only one method 
Php :: php pass function as callback 
Php :: php variable definition 
Php :: laravel verify email custom url 
Php :: laravel "query()-find" 
Php :: laravel api error return homepage 
Php :: avatar generator laravel 
Php :: show date php by letters 
Php :: php triple quotes 
Php :: what is php file 
Php :: string function in php 
Php :: parameter to laravel seeder 
Php :: create controller codeigniter 3 
Php :: laravel eloquent relationships 
Php :: laravel create command tutorial 
Php :: php "?int" 
Php :: php get date from day of year 
Php :: php-oop 
Php :: PHP Example - AJAX and XML 
Php :: yii2 change transport 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =