isMethod('POST') || $request->is('*/create')) { return User::can('publicity.publicity.create'); } // Determine if the user is authorized to update an entry, if ($request->isMethod('PUT') || $request->isMethod('PATCH') || $request->is('*/edit')) { return User::can('publicity.publicity.edit'); } // Determine if the user is authorized to delete an entry, if ($request->isMethod('DELETE')) { return User::can('publicity.publicity.delete'); } // Determine if the user is authorized to view the module. return User::can('publicity.publicity.view'); } /** * Get the validation rules that apply to the request. * * @return array */ public function rules(\Illuminate\Http\Request $request) { // validation rule for create request. if ($request->isMethod('POST')) { return [ '' => 'required', 'title' => 'required', 'image' => 'required', ]; } // Validation rule for update request. if ($request->isMethod('PUT') || $request->isMethod('PATCH')) { return [ '' => 'required', 'title' => 'required', 'image' => 'required', ]; } // Default validation rule. return [ ]; } }