{"id":8069,"date":"2015-11-23T22:48:45","date_gmt":"2015-11-23T22:48:45","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2015\/11\/23\/how-to-get-the-current-url-inside-if-statement-blade-in-laravel-4-open-source-projects-laravel-laravel\/"},"modified":"2022-08-30T15:45:32","modified_gmt":"2022-08-30T15:45:32","slug":"how-to-get-the-current-url-inside-if-statement-blade-in-laravel-4-open-source-projects-laravel-laravel","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2015\/11\/23\/how-to-get-the-current-url-inside-if-statement-blade-in-laravel-4-open-source-projects-laravel-laravel\/","title":{"rendered":"How to get the current URL inside @if statement (blade) in Laravel 4?-open source projects laravel\/laravel"},"content":{"rendered":"<p><img decoding=\"async\" src=\"http:\/\/i.stack.imgur.com\/N8pB8.jpg?s=128&amp;g=1\" \/> <strong>Naing Win<\/strong><\/p>\n<p>You can also use <code>Route::current()-&gt;getName()<\/code> to check your route name.<\/p>\n<p>Example: routes.php<\/p>\n<pre><code>Route::get('test', ['as'=&gt;'testing', function() {\n    return View::make('test');\n}]);\n<\/code><\/pre>\n<p>View:<\/p>\n<pre><code>@if(Route::current()-&gt;getName() == 'testing')\n    Hello This is testing\n@endif\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Naing Win You can also use Route::current()-&gt;getName() to check your route name. Example: routes.php Route::get(&#8216;test&#8217;, [&#8216;as&#8217;=&gt;&#8217;testing&#8217;, function() { return View::make(&#8216;test&#8217;); }]); View: @if(Route::current()-&gt;getName() == &#8216;testing&#8217;) Hello This is testing @endif<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,1],"tags":[],"class_list":["post-8069","post","type-post","status-publish","format-standard","hentry","category-laravel","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8069","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=8069"}],"version-history":[{"count":1,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8069\/revisions"}],"predecessor-version":[{"id":8649,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/8069\/revisions\/8649"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=8069"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=8069"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=8069"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}