iritesh37
Store Files Privately
Try this:
And on table column:
Add this on your AppServiveProvider inside boot:
Add the route in web.php
* if you need files from sub-folder then add: ->where('photopath', '.')
On filesystems.php config,
FileUpload::make('photopath')
->disk('local')->directory('users')
->moveFiles()
->visibility('private')
->imageEditor()
->image()
->label('Photo'),
FileUpload::make('photopath')
->disk('local')->directory('users')
->moveFiles()
->visibility('private')
->imageEditor()
->image()
->label('Photo'),
ImageColumn::make('photopath')
->label('Photo')
->disk('local')
->visibility('private'),
ImageColumn::make('photopath')
->label('Photo')
->disk('local')
->visibility('private'),
Storage::disk('local')->buildTemporaryUrlsUsing(function ($photopath, $expiration, $options) {
return URL::temporarySignedRoute(
'local.temp',
$expiration,
array_merge($options, ['photopath' => $photopath])
);
});
Storage::disk('local')->buildTemporaryUrlsUsing(function ($photopath, $expiration, $options) {
return URL::temporarySignedRoute(
'local.temp',
$expiration,
array_merge($options, ['photopath' => $photopath])
);
});
Route::get('local/temp/{photopath}', function (string $photopath){
return Storage::disk('local')->download($photopath);
})->where('photopath', '.*')->name('local.temp');
Route::get('local/temp/{photopath}', function (string $photopath){
return Storage::disk('local')->download($photopath);
})->where('photopath', '.*')->name('local.temp');
'local' => [
'driver' => 'local',
'root' => storage_path('app/images'),
'throw' => false,
],
'local' => [
'driver' => 'local',
'root' => storage_path('app/images'),
'throw' => false,
],
15 replies