예제 #1
0
 /**
  * Remove the task.
  *
  * @param Request $request
  * @param Model   $task
  *
  * @return json
  */
 public function destroy(TaskAdminApiRequest $request, Task $task)
 {
     try {
         $t = $task->delete();
         return response()->json(['message' => trans('messages.success.delete', ['Module' => trans('task::task.name')]), 'code' => 2006])->setStatusCode(202, 'DESTROY_SUCCESS');
     } catch (Exception $e) {
         return response()->json(['message' => $e->getMessage(), 'code' => 4006])->setStatusCode(400, 'DESTROY_ERROR');
     }
 }
예제 #2
0
 /**
  * Remove the task.
  *
  * @param Model   $task
  *
  * @return Response
  */
 public function destroy(TaskAdminRequest $request, Task $task)
 {
     try {
         $t = $task->delete();
         return response()->json(['message' => trans('messages.success.deleted', ['Module' => trans('task::task.name')]), 'code' => 202, 'redirect' => trans_url('/admin/task/task')], 202);
     } catch (Exception $e) {
         return response()->json(['message' => $e->getMessage(), 'code' => 400, 'redirect' => trans_url('/admin/task/task/' . $task->getRouteKey())], 400);
     }
 }
예제 #3
0
 public function transform(\Lavalite\Task\Models\Task $task)
 {
     return ['id' => $task->getRouteKey(), 'parent_id' => $task->parent_id, 'start' => $task->start, 'end' => $task->end, 'category' => $task->category, 'task' => $task->task, 'time_required' => $task->time_required, 'time_taken' => $task->time_taken, 'priority' => $task->priority, 'status' => $task->status, 'created_by' => $task->created_by, 'created_at' => $task->created_at];
 }
예제 #4
0
 /**
  * Remove the specified resource.
  *
  * @param int $id
  *
  * @return Response
  */
 public function destroy(TaskUserRequest $request, Task $task)
 {
     try {
         $this->repository->delete($task->getRouteKey());
         return redirect(trans_url('/user/task/task'))->with('message', trans('messages.success.deleted', ['Module' => trans('task::task.name')]))->with('code', 204);
     } catch (Exception $e) {
         redirect()->back()->withInput()->with('message', $e->getMessage())->with('code', 400);
     }
 }