/** * @param $id * @param Request $request * @return mixed */ public function destroy($id, Request $request) { $shout = Shout::findOrFail($id); if ($request->user()->isAdmin()) { $shout->delete(); return back()->with('success', "Success! Shout deleted"); } else { return back()->with('error', "Sorry! You are not authorized for that action"); } }
/** * Remove the specified resource from storage. * * @param int $id * @param Request $request * @return \Illuminate\Http\Response */ public function destroy($id, Request $request) { $shout = Shout::findOrFail($id); if ($request->user()->can('delete', $shout)) { $shout->delete(); return back()->withNotification("Success! Shout deleted")->withType("success"); } else { return back()->withNotification("Sorry! You are not authorized for that action")->withType("Danger"); } }