0

I want Call this middleware in All Route Without Define in Web.php or controller and please give some deeply idea about Middleware. like middleware middlewareGroups routeMiddleware and also give some idea about permission in laravel.(Role Wise)

<?php

namespace App\Http\Middleware;

use Closure;

class KeyTokenExist
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {

            return redirect('/admin/employee');

    }
}

THANK YOU!!!!

2 Answers 2

2

You can add it to the global middleware stack in app/http/kernel.php.

However if you will add a redirect here, your website will redirect indefinitely.

Sign up to request clarification or add additional context in comments.

1 Comment

can you please give me explaination of all type of middleware how to use in laravel with any example i want understand deeply knowledge about Middlewarw THANK YOU@jerodev
0

Here is all you need to know about middleware: Laravel Middlewares

It is as deep as it can go. There is no point of copy-pasting the same data over here.

1 Comment

Thank you @Learner

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.