Create that folder with appropriate permissions.
mkdir -p /home/foo/www/laravel/storage/venues/hero
Read more here. Suggested permissions are 775 or 664.
Hello,
I'm trying to save an image in local storage when creating a factory. My code so far looks like this:
public function definition()
{
return [
'venue_id' => Venue::factory(),
'photo' => $this->faker->image(storage_path('venues/hero'), 1200, 300, null, false)
];
}
The problem is that if I try to use this factory I get the following error:
InvalidArgumentException with message 'Cannot write to directory "/home/foo/www/laravel/storage/venues/hero"'
From the controller I save the uploaded image a following and it works:
$photo = $request->file('hero_photo')->store('venues/hero', 'public');
I also tried without storage_path() but it didn't work.
What can I do?
Thanks!
Please or to participate in this conversation.