80332/how-to-access-url-for-the-current-if-statement-of-laravel
I can access the url using php like <?php echo URL::current(); ?> but I guess it is not possile for @if blade statement.. so I wanted to access url through laravel?how can i do it?
Hello @ subham ,
If you want to access the current url inside an @if statement in laravel just use the below syntax:
@if(Request::url() === 'your url here') // code.............. @endif
Hope it helps!! Thank you!
Hello @subham,
if you want to use url in list blade you can do something like this:
<li class="{{ Request::is('mycategory/', '*') ? 'active' : ''}}">
Hello @ subham,
Yes,you can use in both unorder and ordered list as well. Alternate method you can use is:
<li{!!(Request::is('your_url')) ? ' class="active"' : '' !!}> or <li @if(Request::is('your_url'))class="active"@endif>
Hope it helps!! Thank you!!
Hello, You can first refer how to Create controller through ...READ MORE
Hello @kartik, This is the way how to ...READ MORE
Hello @kartik, There are date helpers available in ...READ MORE
Hello @kartik, You can get the current user's ...READ MORE
If there is permission issue, give the ...READ MORE
If there is not .ebignore file it ...READ MORE
phpBB would be the first that comes ...READ MORE
I installed laravel 6.0 through composer and ...READ MORE
Hello @kartik, You can use: Request::url() to obtain the current ...READ MORE
Hello, To create both of the created_at and updated_at columns: $t->timestamp('created_at')->default(DB::raw('CURRENT_TIMESTAMP')); $t->timestamp('updated_at')->default(DB::raw('CURRENT_TIMESTAMP on update ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.