laravel livewire file update Real-Time File Validation mutile files
https://laravel-news.com/livewire-file-upload
Real-Time File Validation```
use Livewire\Component;
use Livewire\WithFileUploads;
class Show extends Component
{
use WithFileUploads;
public $files = [];
public function updatedFiles() // 即時檢查檔案格式
{
$this->validate([
'files.*' => 'image|max:1024', // 1MB Max
]);
}
public function store()
{
$filenames = collect($this->photos)->map->store('photos');
'files' => $filenames->implode(','),
updatedFiles() is Hook into the “updated”
updatedPhoto public $Photo
updatedPhotos public $photos = []
updatedFile public $file
updatedFiles public $files = []