Changeset bd9e8e3 for app/Http/Requests/Dashboard
- Timestamp:
- 10/17/21 20:28:35 (3 years ago)
- Branches:
- develop, master
- Children:
- e6c1f87
- Parents:
- d795fa6
- Location:
- app/Http/Requests/Dashboard
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
app/Http/Requests/Dashboard/DocumentRequest.php
rd795fa6 rbd9e8e3 16 16 public function authorize() 17 17 { 18 if ($this->isMethod("patch")) {18 if ($this->isMethod("patch")) { 19 19 $document = Document::find($this->route("id")); 20 20 return auth()->user()->hasPermission("edit_all_documents") || ($document->user->id == auth()->user()->id); … … 33 33 34 34 $rules = [ 35 "arch_id" => "required|min:10|max:255", 35 "arch_id" => [ 36 "required", 37 function($attribute, $value, $fail) { 38 $arch_id = $this->request->get('arch_id'); 39 $deptId = explode('/', $arch_id)[0]; 40 if ($deptId !== $this->request->get('department')) { 41 $fail("Dept id error"); 42 } 43 } 44 ], 36 45 "name" => "required|min:10|max:255", 37 46 "department" => "required|integer|exists:departments,id", … … 39 48 ]; 40 49 41 if ($this->isMethod("patch")) {50 if ($this->isMethod("patch")) { 42 51 $fileRules = [ 43 52 "file_item.*" => "mimes:jpg,jpeg,png|max:4096" 44 53 ]; 45 54 } else { 46 55 $fileRules = [ -
app/Http/Requests/Dashboard/UsernameSettingsRequest.php
rd795fa6 rbd9e8e3 4 4 5 5 use Illuminate\Foundation\Http\FormRequest; 6 use Illuminate\Contracts\Validation\Validator; 7 use Illuminate\Validation\ValidationException; 6 8 7 9 class UsernameSettingsRequest extends FormRequest … … 28 30 ]; 29 31 } 32 33 protected function failedValidation(Validator $validator) 34 { 35 $response = redirect() 36 ->route('dashboard.settings.index') 37 ->with(['active_tab' => 'security']) 38 ->withErrors($validator); 39 40 throw (new ValidationException($validator, $response)) 41 ->errorBag($this->errorBag) 42 ->redirectTo($this->getRedirectUrl()); 43 } 30 44 }
Note:
See TracChangeset
for help on using the changeset viewer.