As soon, I am typing php artisan db:seed
command.
I\'m getting Error Like:
[ReflectionException]
Clas
I've recreated class, and it worked. Copy all file content, delete file, and run php artisan make:seeder ModelTableSeeder
. Because composer dump-autoload
didn't worked for me.
Perform a composer update
, then composer dump-autoload
.
If the above doesn't solve the problem, change the classmap
in your composer.json
file such that it contains the project-relative path to your php files:
"autoload-dev": {
"classmap": [
"tests/TestCase.php",
"database/seeds/UserTableSeeder.php" //include the file with its path here
]
}, /** ... */
and soon after, perform a composer dump-autoload
, and it should work now like a breeze!
If composer dump-autoload
is not found, just enable this option composer config -g -- disable-tls true
.
I am not writing as the answer for this question. But I want to help others if they faced the same bug but the answers mentioned here not works. I also tried all the solutions mentioned here. But my problem was with the namespace I used. The path was wrong.
The namespace I used is:
namespace App\Http\Controllers;
But actually the controller reside inside a folder named 'FrontEnd'
so the solution is change the namespace to:
namespace App\Http\Controllers\Frontend;
I had this error when trying to reach an endpoint in a custom route file, that had a namespace prepended in RouteServiceProvider
RouteServiceProvider
into account)$router->group(['namespace' ...])
in the RouteServiceProvider
was incorrect.Updating the namespace in the RouteServiceProvider
solved the issue, as the relative controller path specified in the routes file was now resolving correctly.