public function destroy(TaskRequest $request, Task $task)
    {
        try {

            $task->delete();
            return $this->response->message(trans('messages.success.deleted', ['Module' => trans('task::task.name')]))
                ->code(202)
                ->status('success')
                ->url(guard_url('task/task'))
                ->redirect();

        } catch (Exception $e) {

            return $this->response->message($e->getMessage())
                ->code(400)
                ->status('error')
                ->url(guard_url('task/task/' . $task->getRouteKey()))
                ->redirect();
        }

    }
public function destroy(TaskRequest $request, Task $task)
    {
        try {

            $task->delete();
            return $this->response->message(trans('messages.success.deleted', ['Module' => trans('task::task.name')]))
                ->code(202)
                ->status('success')
                ->url(guard_url('task/task'))
                ->redirect();

        } catch (Exception $e) {

            return $this->response->message($e->getMessage())
                ->code(400)
                ->status('error')
                ->url(guard_url('task/task/' . $task->getRouteKey()))
                ->redirect();
        }

    }
public function destroy ( TaskRequest $ request , Task $ task ) { try { $ task -> delete ( ) ; return $ this -> response -> message ( trans ( 'messages.success.deleted' , [ 'Module' => trans ( 'task::task.name' ) ] ) ) -> code ( 202 ) -> status ( 'success' ) -> url ( guard_url ( 'task/task' ) ) -> redirect ( ) ; } catch ( Exception $ e ) { return $ this -> response -> message ( $ e -> getMessage ( ) ) -> code ( 400 ) -> status ( 'error' ) -> url ( guard_url ( 'task/task/' . $ task -> getRouteKey ( ) ) ) -> redirect ( ) ; } }
Remove the task.

@param Model   $task

@return Response
Remove the task .