Vaweto's avatar
Level 18

Error : Class "Faker\Factory" not found after Upgrade to Laravel 8 and use factory legacy

After i upgrade my project from laravel 7 to laravel 8 and use legacy factory package i receive an error Error : Class "Faker\Factory" not found

Seems like missing Faker.

Any Ideas please!!!

0 likes
7 replies
Vaweto's avatar
Level 18

Yeah. The old factories use Generator/Faker but so i had to require the fzaninotto/faker package. And the error gone but i receive a new error from the package.

typeError : join(): Argument #2 ($array) must be of type ?array, string given /opt/project/vendor/fzaninotto/faker/src/Faker/Provider/Lorem.php:95 /opt/project/vendor/fzaninotto/faker/src/Faker/Provider/Lorem.php:110 /opt/project/vendor/fzaninotto/faker/src/Faker/Generator.php:193 /opt/project/vendor/fzaninotto/faker/src/Faker/Generator.php:232

Vaweto's avatar
Level 18

@Sinnbeck 'title'=> $faker->sentences,

This method comes from the package. A you can see trying to join words on string!! I think i have to fork it!!

public static function sentence

    $words = static::words($nbWords);
    $words[0] = ucwords($words[0]);

    return join($words, ' ') . '.';
harlan_gray's avatar

Had the same issue while upgrading. This worked. Thank you.

Please or to participate in this conversation.