Last change
on this file since d95fdd2 was c6b84df, checked in by beratkjufliju <kufliju@…>, 3 years ago |
added fileTypes controller, notifications, excel export, edited views
|
-
Property mode
set to
100644
|
File size:
1.8 KB
|
Rev | Line | |
---|
[c6b84df] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | namespace App\Http\Requests\Dashboard;
|
---|
| 4 |
|
---|
| 5 | use Illuminate\Foundation\Http\FormRequest;
|
---|
| 6 | use League\Flysystem\Util\MimeType;
|
---|
| 7 | use League\MimeTypeDetection\MimeTypeDetector;
|
---|
| 8 |
|
---|
| 9 | class FileTypeRequest extends FormRequest
|
---|
| 10 | {
|
---|
| 11 | /**
|
---|
| 12 | * Determine if the user is authorized to make this request.
|
---|
| 13 | *
|
---|
| 14 | * @return bool
|
---|
| 15 | */
|
---|
| 16 | public function authorize()
|
---|
| 17 | {
|
---|
| 18 | return true;
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 | /**
|
---|
| 22 | * Get the validation rules that apply to the request.
|
---|
| 23 | *
|
---|
| 24 | * @return array
|
---|
| 25 | */
|
---|
| 26 | public function rules()
|
---|
| 27 | {
|
---|
| 28 | return [
|
---|
| 29 | "mimes" => [
|
---|
| 30 | "required",
|
---|
| 31 | // function ($attribute, $value, $fail) {
|
---|
| 32 | //
|
---|
| 33 | // try {
|
---|
| 34 | // $mimeType = mimes;
|
---|
| 35 | // @dd($mimeType);
|
---|
| 36 | // $mimetypes = $guesser->guess($pubdir . $avatar);
|
---|
| 37 | //// if ($mimetypes == null) {
|
---|
| 38 | //// $validator->errors()->add('avatar', 'No valid Mime/Type');
|
---|
| 39 | //// return $validator;
|
---|
| 40 | //// }
|
---|
| 41 | //// }
|
---|
| 42 | ////
|
---|
| 43 | ////$mime= explode ('/', $mimetypes);
|
---|
| 44 | ////if ($mime[0] != 'image') {
|
---|
| 45 | //// $validator->errors()->add('avatar', 'Not a valid image');
|
---|
| 46 | ////}
|
---|
| 47 | //
|
---|
| 48 | // if (empty($archNum)) {
|
---|
| 49 | // $fail("Please enter folders Archive ID");
|
---|
| 50 | // }
|
---|
| 51 | //
|
---|
| 52 | // if ($deptId !== Department::find($this->request->get('department'))->code) {
|
---|
| 53 | // $fail("Folder Archive ID field format is invalid");
|
---|
| 54 | // }
|
---|
| 55 | // } catch (\Exception $e) {
|
---|
| 56 | // $fail("Please enter folders Archive ID");
|
---|
| 57 | // }
|
---|
| 58 | // }
|
---|
| 59 | ],
|
---|
| 60 | "max_size" => "required|integer",
|
---|
| 61 | ];
|
---|
| 62 | }
|
---|
| 63 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.