LoginSignup
3
1

More than 5 years have passed since last update.

Controllerのサブディレクトリの追加エラーの解決法

Posted at

/ControllersにぽんぽんControllerを作ってもちゃーんと動いてました。

でも、/Controllers/Customerというディレクトリを新たに追加したらエラーが出た・・・。
Controllers/Authは問題ないのに。

エラー

ReflectionException in compiled.php line 8468:
Class App\Http\Controllers\CorporateController does not exist

コードはどんな感じ?

route.php
Route::get('/admin/corporate', CorporateController::class.'@getDetail');

ルートの名前空間の設定についてはProviders\RouteServiceProvider.phpにかいてある、らしい。
けど、とりあえず以下の通りに書いたら解決しました。

解決後のコード

php.route.php
Route::get('/admin/corporate', Customer\CorporateController::class.'@getDetail');

たぶん、他の方法はあるんだろうけどまずは解決したので一旦よしとする。
他に見つけたらまた追記します。

3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1