0

i have project on laravel 5.5 im using middleware and this is the code

<?php
namespace App\Http\Middleware;
use Closure;
class roleMiddleware
{
 public function handle($request, Closure $next)
{
    // if code to check where the url is 
    // code here
    //else
    //code here
    //else
    //code
    //return $next($request);
}
}

so i need code to check where the request come from and if it == something do this if it == something else do that

1
  • how can i get the url the request come from in the middleware Commented Sep 21, 2017 at 23:17

1 Answer 1

1

You can use inside of your middleware:

$request->url(); // without query string

With query string you can use:

$request->fullUrl();

For more Request methods, see Illuminate\Http\Request.php class.

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

Comments

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.