Changeset c6b84df for app/Http/Requests/Dashboard/FileRequest.php
- Timestamp:
- 10/21/21 23:45:59 (3 years ago)
- Branches:
- develop, master
- Children:
- 4b7e2d3
- Parents:
- 6b95845
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
app/Http/Requests/Dashboard/FileRequest.php
r6b95845 rc6b84df 3 3 namespace App\Http\Requests\Dashboard; 4 4 5 use App\Helpers\Alert; 6 use App\Models\FileType; 7 use App\Rules\UploadCount; 5 8 use Illuminate\Foundation\Http\FormRequest; 6 9 … … 24 27 public function rules() 25 28 { 26 return [ 27 "name" => "required|max:255|regex:/^[^.]+$/", 28 ]; 29 $rules = [ 30 "folder" => "required|integer|exists:folders,id", 31 ]; 32 33 $mimes = FileType::find("1")->mimes; 34 $maxSize = FileType::find("1")->max_size; 35 36 if ($this->isMethod("patch")) { 37 $fileRules = [ 38 "file_item.*" => "mimes:{$mimes}|max:{$maxSize}" 39 ]; 40 } 41 42 else { 43 $fileRules = [ 44 "file_item.*" => "mimes:{$mimes}|max:{$maxSize}" 45 ]; 46 } 47 48 $rules = array_merge( 49 $rules, 50 $fileRules, 51 ); 52 53 return $rules; 29 54 } 30 55 }
Note:
See TracChangeset
for help on using the changeset viewer.