RuntimeException Could not scan for classes inside "database/factories" Laravel

Viewed 8959

i need to install Laravel charts in my project. after installing

composer require consoletvs/charts:6.*

I have this error :

[RuntimeException]
Could not scan for classes inside "database/factories" which does not appear 
to be a file nor a folder

So after when i copy my provides and allias in App folder, i got :

Class 'ConsoleTVs\Charts\ChartsServiceProvider' not found

Anyone can help please ?

2 Answers

I've just had this error crop up. It was because I'd removed all of the files from the database/factories folder. The options to fix were either to add a stub factory file back into the folder. The UserFactory.php that comes with Laravel will do.

<?php
use Faker\Generator as Faker;

$factory->define(App\User::class, function (Faker $faker) {
    return [
        'name' => $faker->name,
        'email' => $faker->unique()->safeEmail,
        'email_verified_at' => now(),
        'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
        'remember_token' => str_random(10),
    ];
});

The alternative is to remove from composer.json

"classmap": [
    "database/factories"
],
Related