Say i have localhost/public/admin
that redirects immediately to localhost/public/user/login
.
How am I going to get the admin
value in user/login
?
Say i have localhost/public/admin
that redirects immediately to localhost/public/user/login
.
How am I going to get the admin
value in user/login
?
You'll need to grab the referer and check if it is contains 'admin'. Try the following
Edit #1: As pointed out by @tomvo you can also use
URL::previous()
instead ofRequest::referer()
in L4Edit #2: It's actually mispelled as
referer
instead ofreferrer
as point out by @JamesFEdit #3: In Laravel 5 the
Request::referer()
method doesn't seem to exist anymore, you can still get it by usingRequest::header('referer')
as point out by @TheSerenin