user(); return $user->hasPermissionTo('add-tollhouse') || ($user->hasPermissionTo('add-tollhouse-province') && $this->province_id == $user->province_id); } /** * Get the validation rules that apply to the request. * * @return array|string> */ public function rules(): array { return [ 'province_id' => 'required|exists:provinces,id', 'city_id' => 'required|exists:cities,id', 'name' => 'required|string|max:255', 'status' => 'required|in:0,1', 'type' =>'required|in:1,2,3', 'team_num' => 'numeric', 'staff_num' => 'numeric', 'phone' => 'string|max:50', 'responsible_name' => 'string|max:255', 'responsible_mobile' => 'string|max:50', 'successor_name' => 'string|max:255', 'successor_mobile' => 'string|max:50', 'machines_light' => 'numeric', 'machines_sheavy' => 'numeric', 'machines_heavy' => 'numeric', 'code' => 'string|max:50', 'lat' => 'numeric', 'lng' => 'numeric', 'overview_files_1' => 'file|mimes:jpg,jpeg,png,pdf|max:51200', 'overview_files_2' => 'file|mimes:jpg,jpeg,png,pdf|max:51200', 'overview_files_3' => 'file|mimes:jpg,jpeg,png,pdf|max:51200', 'overview_files_4' => 'file|mimes:jpg,jpeg,png,pdf|max:51200', 'overview_files_5' => 'file|mimes:jpg,jpeg,png,pdf|max:51200', ]; } }