// まずシンボリックリンクを貼ります
$ php artisan storage:link
// 続いてflysystem install
$ composer require league/flysystem-aws-s3-v3 ~1.0
$ composer require league/flysystem-cached-adapter ~1.0
.envの設定
AWS_ACCESS_KEY_ID= AWS_SECRET_ACCESS_KEY= AWS_DEFAULT_REGION=ap-northeast-1 AWS_BUCKET=
config/filesystem.php
'local' => [
'driver' => 'local',
'root' => storage_path('app'),
],
controller test
-> 取得できているか確認。filesystemでstorage_path(‘app’)となっているので、storage/app/にテストファイルを置く
public function file(){
$file = Storage::get('test.jpg');
dd($file);
}
putFileAs
public function file(){
$file1 = storage_path('app/test.jpg');
$filename = 'hoge.jpg';
Storage::disk('s3')->putFileAs('/', $file1, $filename, 'public');
echo "done";
}
ファイルパスの取得
public function file(){
$path = Storage::disk('s3')->url('test.jpg');
echo $path;
}
あ、思い出した。






