Pre-fill support for file input (#222)
Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
@@ -16,15 +16,20 @@ class UploadAssetRequest extends FormRequest
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
$fileTypes = [
|
||||
'png',
|
||||
'jpeg',
|
||||
'jpg',
|
||||
'bmp',
|
||||
'gif',
|
||||
'svg'
|
||||
];
|
||||
if ($this->offsetExists('type') && $this->get('type') === 'files') {
|
||||
$fileTypes = [];
|
||||
}
|
||||
|
||||
return [
|
||||
'url' => ['required',new StorageFile(self::FORM_ASSET_MAX_SIZE, [
|
||||
'png',
|
||||
'jpeg',
|
||||
'jpg',
|
||||
'bmp',
|
||||
'gif',
|
||||
'svg'
|
||||
])],
|
||||
'url' => ['required', new StorageFile(self::FORM_ASSET_MAX_SIZE, $fileTypes)],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user