You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// return $this->attributes[{$attribute_name}]; // uncomment if this is a translatable field
965
965
}
@@ -969,7 +969,7 @@ public function setImageAttribute($value)
969
969
970
970
The field sends the file, through a Request, to the Controller. The Controller then tries to create/update the Model. That's when the mutator on your model will run. That also means we can do any [file validation](https://laravel.com/docs/5.3/validation#rule-file) (```file```, ```image```, ```mimetypes```, ```mimes```) in the Request, before the file is stored on the disk.
971
971
972
-
>NOTE: If this field is mandatory (required in validation) please use the [sometimes laravel validation rule](https://laravel.com/docs/5.8/validation#conditionally-adding-rules) together with **required** in your validation. (sometimes|required|file etc... )
972
+
>NOTE: If this field is mandatory (required in validation) please use the [sometimes laravel validation rule](https://laravel.com/docs/9.x/validation#conditionally-adding-rules) together with **required** in your validation. (sometimes|required|file etc... )
973
973
974
974
[The ```uploadFileToDisk()``` method](https://github.com/Laravel-Backpack/CRUD/blob/master/src/app/Models/Traits/HasUploadFields.php#L31-L59) will take care of everything for most use cases:
975
975
@@ -984,7 +984,7 @@ The field sends the file, through a Request, to the Controller. The Controller t
984
984
* - if the value is null, deletes the file and sets null in the DB
985
985
* - if the value is different, stores the different file and updates DB value
986
986
* /
987
-
public function uploadFileToDisk($value, $attribute_name, $disk, $destination_path) {}
987
+
public function uploadFileToDisk($value, $attribute_name, $disk, $destination_path, $fileName = null) {}
988
988
```
989
989
990
990
If you wish to have a different functionality, you can delete the method call from your mutator and do your own thing.
0 commit comments