Search
 
SCRIPT & CODE EXAMPLE
 

PHP

laravel restrict route methods

   public function __construct()
    {
        $this->middleware('auth')->except(['index', 'show']);
    }
Comment

laravel restrict route

namespace AppHttpMiddleware;

use AppArticle;
use Closure;
use IlluminateContractsAuthGuard;

class AdminMiddleware
{
    /**
     * The Guard implementation.
     *
     * @var Guard
     */
    protected $auth;

    /**
     * Create a new filter instance.
     *
     * @param  Guard  $auth
     * @return void
     */
    public function __construct(Guard $auth)
    {
        $this->auth = $auth;
    }

    /**
     * Handle an incoming request.
     *
     * @param  IlluminateHttpRequest  $request
     * @param  Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
        if ($this->auth->getUser()->type !== "admin") {
            abort(403, 'Unauthorized action.');
        }

        return $next($request);
    }
}
Comment

PREVIOUS NEXT
Code Example
Php :: how to get attachments to emails php 
Php :: wordpress reserved image size name 
Php :: php .= 
Php :: how to solve php mysqli_query function problem does not execute 
Php :: php append string 
Php :: laravel blade conditional class 
Php :: php-fpm docker 
Php :: strict types php 
Php :: PHP Fatal error: Uncaught Error: Call to undefined function mcrypt_encrypt() 
Php :: php proper function comments 
Php :: mail sending setting magneto for mailhog 
Php :: php check valid json string 
Php :: wordpress is_tag function 
Php :: Termlaravel validation exists array data 
Php :: Stored Procedures in Laravel 
Php :: Allowed memory size of 1610612736 bytes exhausted (tried to allocate 4096 bytes) laravel 
Php :: magento 2 get number of cart items 
Php :: php custom autoload 
Php :: current pathinfo php 
Php :: laravel count distance lat/longtidue 
Php :: route laravel Target class [AuthController] does not exist 
Php :: wp add menu page and subpage 
Php :: laravel file store 
Php :: ci constructor 
Php :: get data from another table laravel 
Php :: how to check the day of any date in php 
Php :: wordpress if is not page template 
Php :: message get with return action laravel 
Php :: laravel model soft delete 
Php :: laravel reload relationship 
ADD CONTENT
Topic
Content
Source link
Name
9+6 =