{"id":3015,"date":"2014-03-13T12:11:27","date_gmt":"2014-03-13T12:11:27","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/13\/get-controller-and-action-name-in-laravel-4-collection-of-common-programming-errors-2\/"},"modified":"2022-08-30T15:45:33","modified_gmt":"2022-08-30T15:45:33","slug":"get-controller-and-action-name-in-laravel-4-collection-of-common-programming-errors-2","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/13\/get-controller-and-action-name-in-laravel-4-collection-of-common-programming-errors-2\/","title":{"rendered":"get controller and action name in Laravel 4-Collection of common programming errors"},"content":{"rendered":"<p>I&#8217;m trying to access the name of the current controller and the current method to pass it to my view as a variable. I&#8217;ve tried several ways from pointers I found online but they don&#8217;t work so I assume they were for Laravel 3.<\/p>\n<p>Here is what I&#8217;ve tried<\/p>\n<pre><code>Request::$route-&gt;controller\n<\/code><\/pre>\n<p>gives<\/p>\n<pre><code>Access to undeclared static property: Illuminate\\Support\\Facades\\Request::$route\n<\/code><\/pre>\n<p>and<\/p>\n<pre><code>Request::route()-&gt;controller\n<\/code><\/pre>\n<p>gives<\/p>\n<pre><code>Call to undefined method Illuminate\\Http\\Request::route()\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m trying to access the name of the current controller and the current method to pass it to my view as a variable. I&#8217;ve tried several ways from pointers I found online but they don&#8217;t work so I assume they were for Laravel 3. Here is what I&#8217;ve tried Request::$route-&gt;controller gives Access to undeclared static [&hellip;]<\/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-3015","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\/3015","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=3015"}],"version-history":[{"count":1,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3015\/revisions"}],"predecessor-version":[{"id":8842,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3015\/revisions\/8842"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3015"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3015"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3015"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}