I'm fairly new to laravel and have encountered a problem with the psr-4 autoloading in my application.
My folder structure:
-app
-config
-controllers
-UsersController
-Mynamespace
-User.php
My composer.json file:
"autoload": {
"classmap": [
"app/commands",
"app/controllers",
"app/database/migrations",
"app/database/seeds",
"app/tests/TestCase.php"
],
"psr-4": {
"Mynamespace\\": "app/Mynamespace"
}
Then I ran:
composer dump-autoload
My User model:
<?php namespace Mynamespace;
use Illuminate\Auth\UserTrait;
use Illuminate\Auth\UserInterface;
use Illuminate\Auth\Reminders\RemindableTrait;
use Illuminate\Auth\Reminders\RemindableInterface;
use Eloquent;
class User extends Eloquent implements UserInterface, RemindableInterface {
...
My vendor/composer/autoload-psr4.php:
...
return array(
'Monolog\\' => array($vendorDir . '/monolog/monolog/src/Monolog'),
'Mynamespace\\' => array($baseDir . '/app/Mynamespace'),
);
Changed my config/auth.php to:
'model' => 'Mynamespace\User',
I keep getting a ReflectionException Class User does not exist error. Please help!
model
inapp/config/auth.php
toMynamespace\User
? – MarwellnUser.php
, right? I ask because you referred to it as your UsersController. – wolfemm