Код: Выделить всё
php artisan storage:link
Коды
Код: Выделить всё
/config/filesystems.php
Код: Выделить всё
'public' => [
'driver' => 'local',
'root' => storage_path('app/public/'),
'url' => env('APP_URL').'/storage',
'visibility' => 'public',
],
Код: Выделить всё
.env
Код: Выделить всё
FILESYSTEM_DRIVER=public
Код: Выделить всё
controller sample
Код: Выделить всё
if ($request->hasFile('image')) {
$image = $request->file('image');
$filename = 'page' . '-' . time() . '.' . $image->getClientOriginalExtension();
$location = storage_path('app/public/images/' . $filename);
Image::make($image)->resize(1200, 600)->save($location);
if(!empty($page->image)){
Storage::delete('images/' . $page->image);
}
$page->image = $filename;
}
Подробнее здесь: https://stackoverflow.com/questions/507 ... production