How can you access a controller that is 3 layers deep in Laravel 3?

211 Views Asked by At

So it seems like this is a routing issue, but I cannot access my controller from another controller. Here is my controller structure:

controllers
--api
----v1
------exercises.php
------helpers.php
------routines.php
--groups
----admin.php
----users.php
--reports.php
--totals.php

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.

Here's an example:

If I want to access method() from the Groups_Users controller, using my Reports controller, all I would do is this:

Users::method()

However, if I want to access api_method() from the Api_V1_Exercises controller, using any other controller, I would think that it would be the same, like this:

Exercises::api_method()

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.

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:

class Api_V1_Exercises_Controller extends \Base_Controller

What am I doing wrong? I really could use some help figuring this one out.

0

There are 0 best solutions below