Support the ongoing development of Laravel.io →
posted 10 years ago
Configuration

Switching from Codeigniter, it was a breeze to do this in. I'm having trouble routing to nested controllers. It's letting me know the class doesn't exist. Here's my route

// These are my routes for the MDPay interface (Separate from the portal)
Route::resource('mdpay', 'mdpay/LoginController@index');

Here is my Controller embedded in the mdpay folder in controllers

 class LoginController extends BaseController {

/**
 * Display a listing of the resource.
 *
 * @return Response
 */
public function index()
{
    $data['title'] = 'MDPay : ';
    return View::make('mdpay/start', array('title'=>$data['title']) );
}
}

When using the route I'm getting this error:

ReflectionException Class mdpay/LoginController does not exist

I'm confused as to how I'm routing wrong. This was working fully until I decided to nest the path under the mdpay folder in the controllers. :(

Last updated 2 years ago.
0

In your composer.json file, you can see the

'autoload' : { 
    'classmap' : { 
          ... 
}

section, add your path to the directory of your controller, then type:

./composer.phar dump-autoload
Last updated 2 years ago.
0

I looks like:

Route::resource('mdpay', 'LoginController');

should work.

You can then run:

php artisan routes

to see what's going on.

If you want a route prefix you could:

Route::group(['prefix' => 'dirname'], function()
{
    Route::resource('mdpay', 'LoginController');
});
Last updated 2 years ago.
0

Thanks, this helped out, but I found the fix after coming back from lunch. I was calling the entire path when all I needed to call was the library. So, the full solution instead of mdpay/LoginController@index, it was simply just LoginController@index.

bomberman1990 said:

In your composer.json file, you can see the

'autoload' : { 'classmap' : { ... }

section, add your path to the directory of your controller, then type:

./composer.phar dump-autoload

Last updated 2 years ago.
0

I saw this after I posted. This is exactly what needed to happen to work. Thanks :)

rags02 said:

I looks like:

Route::resource('mdpay', 'LoginController');

should work.

You can then run:

php artisan routes

to see what's going on.

If you want a route prefix you could:

Route::group(['prefix' => 'dirname'], function()
{
   Route::resource('mdpay', 'LoginController');
});
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

trickell trickell Joined 29 May 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.