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

Location:
app/Http/Requests/Dashboard
Files:
3 added
1 deleted
3 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}
  • app/Http/Requests/Dashboard/NewUserRequest.php

    r6b95845 rc6b84df  
    2929            "phone_number" => "required|unique:users,phone_number",
    3030            "email" => "required|string|email|max:50|unique:users,email",
    31             "username" => "required|min:5|max:30|unique:users,username",
     31            "username" => "required|alpha_dash|min:5|unique:users,username",
    3232            "userRole" => "required|exists:roles,id",
    33             "avatar" => "mimes:jpeg,png,gif|max:5000",
     33            "avatar" => "image|max:5000",
    3434        ];
    3535    }
  • app/Http/Requests/Dashboard/UpdateUserRequest.php

    r6b95845 rc6b84df  
    2929            "phone_number" => "required|unique:users,phone_number,$this->id,id",
    3030            "email" => "required|string|email|max:50|unique:users,email,$this->id,id",
    31             "username" => "required|min:5|unique:users,username,$this->id,id",
     31            "username" => "required|alpha_dash|min:5|unique:users,username,$this->id,id",
    3232            "userRole" => "required|exists:roles,id",
    3333            "avatar" => "mimes:jpeg,png,gif|max:5000",
Note: See TracChangeset for help on using the changeset viewer.