public function destroy(Request $request, Tasks2 $task2) { $response = new Response(); $destroy_message = ''; if (policy($task2)->destroy($request->user(), $task2)) { $task2->delete(); $destroy_message = $response->getStatusText(Response::HTTP_OK); } else { $destroy_message = $response->getStatusText(Response::HTTP_UNAUTHORIZED); } return back()->with('destroy_message', $destroy_message); }