Reputation: 761
Class Database\Factories\Tasks\UserFactory located in ./database/factories/tasks/UserFactory.php does not comply with psr-4 autoloading standard. Skipping.
This is my php file:
<?php
namespace Database\Factories\Tasks;
use App\Models\Tasks\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class UserFactory extends Factory
{
...
}
Located in: database/factories/tasks/
Can someone explain me why this doesnt comply with psr-4 autoloading standard?
Upvotes: 1
Views: 16495
Reputation: 309
Change this line in your composer.json file from this
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "Database/Factories/",
"Database\\Seeders\\": "Database/Seeders/"
}
},
to
"autoload": {
"psr-4": {
"App\\": "app/",
"Database\\Factories\\": "Database/Factories/Task",
"Database\\Seeders\\": "Database/Seeders/"
}
},
Upvotes: 1
Reputation: 41
PSR-4 Autoload Standard is case sensitive. So If your Namespace starts with an Uppercase, your Folder name should do this also.
In your example, the directory should be Database/Factories/Tasks.
Upvotes: 4