Hi,
I'm using faker and seeder to generates fake datas and I would like to upload image in specific folder for my users's projects.
actually my code follow is giving me error Cannot write to directory "/var/www/html/goshr/storage/projets/Kelley/projet_385093/thumbnail/"
$factory->define(Project::class, function (Faker $faker) {
$user = factory(App\User::class)->create([
'is_admin' => 0
]);
$categories = App\Category::pluck('id')->toArray();
$uOM = App\UnityOfMeasurement::pluck('id')->toArray();
$difficulties = App\DifficultyLevel::pluck('id')->toArray();
$status = App\Status::pluck('id')->toArray();
session(['project_identifier' => mt_rand(100000, 999999)]);
$identifier = session('project_identifier');
$storagePath = 'projets/' . $user->username.'/projet_' . $identifier . '/thumbnail/';
if (!Storage::exists($storagePath)) {
// ... je récupère mon image que je vais stoker dans le dossier avatars/[nom-de-l'utilisateur] dans le storage local 'public/'
$storagePath;
}
// $faker->image('public/storage/projets/'.$user->username.'/projet_'.$identifier.'/thumbnail/',640,480, null, false),
return [
'user_id' => $user->id,
'title' => $faker->sentence($nbWords = 6, $variableNbWords = true),
'category_id' => $faker->randomElement($categories),
'id_number' => $identifier ,
'duration' => mt_rand(1,24),
'budget' => mt_rand(1,100),
'unity_of_measurement_id' => $faker->randomElement($uOM),
'difficulty_level_id' => $faker->randomElement($difficulties),
'status_id' => $faker->randomElement($status),
'thumbnail' => $faker->image(storage_path('projets/'.$user->username.'/projet_'.$identifier.'/thumbnail/'),640,480, null, false),
'content' => $faker->text($maxNbChars = 200),
];
});
my folder permission is okay.
How can I do ?
Thank you by advance. S.U.+