-
Advanced Media Library(미디어 라이브러리)Laravel/Nova 2020. 10. 15. 20:51반응형SMALL
- media library 설치
composer require "spatie/laravel-medialibrary:^8.0.0" php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="migrations" php artisan migrate php artisan vendor:publish --provider="Spatie\MediaLibrary\MediaLibraryServiceProvider" --tag="config" composer require league/flysystem-aws-s3-v3 ^v1.0 // laravel8이라면 composer require --with-all-dependencies league/flysystem-aws-s3-v3 "^1.0" composer require aws/aws-sdk-php
@ filesystems.php
's3' => [ ..., "visibility" => "public" ],
@ media-library.php(max_file_size 올리기, disk_name s3로 변경)
'disk_name' => env('MEDIA_DISK', 's3'), /* * The maximum file size of an item in bytes. * Adding a larger file will result in an exception. */ 'max_file_size' => 1024 * 1024 * 1024 * 30,
- env s3 세팅
- 모델 세팅
class Banner extends Model implements HasMedia { use HasFactory, InteractsWithMedia; public function registerMediaCollections(): void { $this->addMediaCollection("images"); } }
- 패키지 설치
novapackages.com/packages/ebess/advanced-nova-media-library
return [ Images::make('Main image', 'main') // second parameter is the media collection name ->conversionOnIndexView('thumb') // conversion used to display the image ->rules('required'), // validation rules ];
LIST'Laravel > Nova' 카테고리의 다른 글
Resource OrderBy(순서) 바꾸는법 (0) 2022.01.13 Excel(엑셀) (0) 2021.12.04 International DateTime(다국어 지원) (0) 2020.10.15 테마 변경(로고, 색깔 등) (0) 2020.10.14 Localization(다국어 지원) (0) 2020.10.14