0
I have a controller that is located in:
app/Http/Controllers/Auth/LoginController
that has the login function.
I created a route in my api.php for when to login access my method:
Route::post('login', 'Auth\LoginController@login');
My login controller:
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\Foundation\Auth\AuthenticatesUsers;
class LoginController extends Controller
...
I get:
Class 'App Http Controllers Auth Auth' not found"
If I change course and leave only:
Route::post('login', 'LoginController@login');
I get:
"Class App Http Controllers Logincontroller does not exist"
I would like to know how to fix this and why the Laravel is so bad with the location of the files?
Are the folders structured correctly? The
composer.json
is configured correctly?– Costamilam
I have a Registercontroller class in the same directory as this Logincontroller class. Scalable finds registercontroller but does not find logincontroller
– veroneseComS
Use the command
composer dump-autoload
or use the parameternamespace
, for example:Route::namespace('Auth')->group(function () {
 // Load Controllers "App\Http\Controllers\Auth"
});
– Valdeir Psr