Laravel 5.6 Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR) Класс '\ App \ Utilisateurs' не найден - PullRequest
0 голосов
/ 24 мая 2018

Сначала я хочу извиниться за мой плохой английский, это не мой естественный язык.

Итак, я сталкиваюсь с ошибкой класса не найден после переименования одной из моих моделей.Я искал кучу времени на Stackoverflow, но все предлагаемые советы не работают.Поэтому я прихожу к вам, чтобы получить вашу помощь и посмотреть, сможем ли мы найти проблему.

После переименования моей модели Utilisateurs в Utilisateur я изменил каждый ее вызов, проверил autoload_classmap.php,сделал composer dump-autoload как предложено в другом потоке, который я нашел в stackoverflow, но все еще та же проблема, у меня есть:

Symfony \ Component \ Debug \ Exception \ FatalThrowableError (E_ERROR)
Class '\App\Utilisateurs' not found

Я не знаю, почему laravel хочет загрузить класс Utilisateurs, а не мой переименованный Utilisateur класс.Я проверил файл миграции, но в нем нет ничего странного (я, вероятно, ошибаюсь).

Я новичок в Laravel и мне нужна помощь / советы, чтобы исправить мою ошибку, если у кого-то есть идеи, выДобро пожаловатьСпасибо заранее, мой модифицированный код приведен ниже, если вам нужно что-то еще, не стесняйтесь спрашивать.

Спасибо

Utilisateur.php после переименования:

    namespace App;

    use Illuminate\Database\Eloquent\Model;
    use Illuminate\Contracts\Auth\Authenticatable;
    use \Illuminate\Auth\Authenticatable as BasicAuthenticatable;
    use Illuminate\Notifications\Notifiable;
    use Illuminate\Database\Eloquent\SoftDeletes;
    use ChristianKuri\LaravelFavorite\Traits\Favoriteability;

    class Utilisateur extends Model implements Authenticatable {

        use BasicAuthenticatable;
        use Notifiable;
        use SoftDeletes;
        use Favoriteability;

        protected $dates = ['deleted_at'];

        protected $fillable = [
            'first_name', 
            'last_name',
            'email', 
            'password',
            'structure',
            'confirmation_token', 
            'email_sent',
        ];

        public function structures(){
            return $this->belongsToMany(Structure::class);
        }

        public function getRememberTokenName(){
            return '';
        }

    }

Файл миграции: 2018_04_22_010424_create_utilisateurs_table.php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUtilisateursTable extends Migration
{

    public function up()
    {
        Schema::create('utilisateurs', function (Blueprint $table) {
            $table->increments('id');
            $table->string('first_name');
            $table->string('last_name');
            $table->string('email')->unique();
            $table->string('password');
            $table->string('structure')->nullable();
            $table->string('confirmation_token')->nullable();
            $table->boolean('email_sent')->nullable();
            $table->timestamps();
            $table->softDeletes();
        });
    }


    public function down()
    {
        Schema::dropIfExists('utilisateurs');
    }
}

Частичное представление из autoload_classmap.php

'App\\Structure' => $baseDir . '/app/Structure.php',
'App\\Traits\\PermTrait' => $baseDir . '/app/Traits/PermTrait.php',
'App\\User' => $baseDir . '/app/User.php',
'App\\Utilisateur' => $baseDir . '/app/Utilisateur.php',
'Carbon\\Carbon' => $vendorDir . '/nesbot/carbon/src/Carbon/Carbon.php',

Журналошибка Laravel

[2018-05-24 11:43:03] local.ERROR: Class '\App\Utilisateurs' not found {"exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Class '\\App\\Utilisateurs' not found at E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Auth\\EloquentUserProvider.php:147)
[stacktrace]
#0 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Auth\\EloquentUserProvider.php(113): Illuminate\\Auth\\EloquentUserProvider->createModel()
#1 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Auth\\SessionGuard.php(352): Illuminate\\Auth\\EloquentUserProvider->retrieveByCredentials(Array)
#2 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Auth\\AuthManager.php(292): Illuminate\\Auth\\SessionGuard->attempt(Array)
#3 E:\\Serveur\\www\\test\\app\\Http\\Controllers\\AccountController.php(30): Illuminate\\Auth\\AuthManager->__call('attempt', Array)
#4 [internal function]: App\\Http\\Controllers\\AccountController->signIn()
#5 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Controller.php(54): call_user_func_array(Array, Array)
#6 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction('signIn', Array)
#7 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(212): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(App\\Http\\Controllers\\AccountController), 'signIn')
#8 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Route.php(169): Illuminate\\Routing\\Route->runController()
#9 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(659): Illuminate\\Routing\\Route->run()
#10 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(30): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#11 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Middleware\\SubstituteBindings.php(41): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#12 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(151): Illuminate\\Routing\\Middleware\\SubstituteBindings->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#13 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#14 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken.php(67): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#15 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\VerifyCsrfToken->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#16 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#17 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\View\\Middleware\\ShareErrorsFromSession.php(49): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#18 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(151): Illuminate\\View\\Middleware\\ShareErrorsFromSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#19 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#20 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Session\\Middleware\\StartSession.php(63): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#21 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(151): Illuminate\\Session\\Middleware\\StartSession->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#22 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#23 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse.php(37): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#24 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(151): Illuminate\\Cookie\\Middleware\\AddQueuedCookiesToResponse->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#25 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#26 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Cookie\\Middleware\\EncryptCookies.php(59): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#27 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(151): Illuminate\\Cookie\\Middleware\\EncryptCookies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#28 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#29 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#30 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(661): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#31 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(636): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#32 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(602): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#33 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Router.php(591): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#34 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#35 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#36 E:\\Serveur\\www\\test\\vendor\\fideloper\\proxy\\src\\TrustProxies.php(57): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#37 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(151): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#38 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#39 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(31): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#40 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#41 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#42 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest.php(31): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#43 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#44 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#45 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#46 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#47 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#48 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode.php(51): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#49 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#50 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Routing\\Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#51 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Pipeline\\Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#52 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#53 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Http\\Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#54 E:\\Serveur\\www\\test\\public\\index.php(55): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#55 {main}
"} 

1 Ответ

0 голосов
/ 24 мая 2018

вы можете проверить строку 70 из config/auth.php?

Как я догадался:

Когда вы прочитаете эту часть исключения, вы увидите, что laravel пытаетсяполучить текущего пользователя и поместить его в модель, и я решил, что это означает, что в файле конфигурации была объявлена ​​неправильная модель пользователя, связанная с аутентификацией.

#0 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Auth\\EloquentUserProvider.php(113): Illuminate\\Auth\\EloquentUserProvider->createModel()
#1 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Auth\\SessionGuard.php(352): Illuminate\\Auth\\EloquentUserProvider->retrieveByCredentials(Array)
#2 E:\\Serveur\\www\\test\\vendor\\laravel\\framework\\src\\Illuminate\\Auth\\AuthManager.php(292): Illuminate\\Auth\\SessionGuard->attempt(Array)
#3 E:\\Serveur\\www\\test\\app\\Http\\Controllers\\AccountController.php(30): Illuminate\\Auth\\AuthManager->__call('attempt', Array)
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...