Ignore:
Timestamp:
10/21/21 23:45:59 (3 years ago)
Author:
beratkjufliju <kufliju@…>
Branches:
develop, master
Children:
4b7e2d3
Parents:
6b95845
Message:

added fileTypes controller, notifications, excel export, edited views

File:
1 edited

Legend:

Unmodified
Added
Removed
  • app/Http/Requests/Dashboard/FileRequest.php

    r6b95845 rc6b84df  
    33namespace App\Http\Requests\Dashboard;
    44
     5use App\Helpers\Alert;
     6use App\Models\FileType;
     7use App\Rules\UploadCount;
    58use Illuminate\Foundation\Http\FormRequest;
    69
     
    2427    public function rules()
    2528    {
    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;
    2954    }
    3055}
Note: See TracChangeset for help on using the changeset viewer.