user3023925 user3023925 - 5 months ago 31
PHP Question

Laravel 5.1 nested controller class not found

The Laravel documentation clearly describes how to change your routes if you nest your controllers in folders. It seems REALLY simple, and yet I'm still getting an error. Here's the error:


"Class App\Http\Controllers\Input\InputController does not exist"


^That path looks 100% correct to me. What gives?

File Structure:

-Controllers

--Auth

--Input

---InputController.php

Routes:

Route::get('input', 'Input\InputController@getInput');


InputController:

<?php namespace App\Http\Controllers;

use Illuminate\Http\Response;

class InputController extends Controller
{
public function getInput()
{
return response()->view('1_input.input_form');
}
}


Thanks for any help!

Answer

Change Controller namespace from

namespace App\Http\Controllers

to

namespace App\Http\Controllers\Input