Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can you access a controller that is 3 layers deep in Laravel 3?
    text
    copied!<p>So it seems like this is a routing issue, but I cannot access my controller from another controller. Here is my controller structure:</p> <pre><code>controllers --api ----v1 ------exercises.php ------helpers.php ------routines.php --groups ----admin.php ----users.php --reports.php --totals.php </code></pre> <p>So the issue is accessing any of my api controllers from another controller. I can hit any of them just fine by hitting a url like mysite.com/index.php/api/v1/routines/routine/1, but I accessing them from another controller is out of the question.</p> <p>Here's an example:</p> <p>If I want to access <code>method()</code> from the <code>Groups_Users</code> controller, using my <code>Reports</code> controller, all I would do is this: </p> <pre><code>Users::method() </code></pre> <p>However, if I want to access <code>api_method()</code> from the <code>Api_V1_Exercises</code> controller, using any other controller, I would think that it would be the same, like this:</p> <pre><code>Exercises::api_method() </code></pre> <p>This DOES NOT work, and I have NO idea why... The names of the classes are unique, so I really don't know what is going on.</p> <p>Also, in the controllers that are in sub-folders, they are extending the base controller like everything else, but they have a \ before it, like this:</p> <pre><code>class Api_V1_Exercises_Controller extends \Base_Controller </code></pre> <p>What am I doing wrong? I really could use some help figuring this one out.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload