/**
  * @param  $id
  * @throws GeneralException
  * @return Task
  */
 public function findOrThrowException($id)
 {
     $task = Task::find($id);
     if (!is_null($task)) {
         return $task;
     }
     throw new GeneralException(trans('exceptions.frontend.quiz.tasks.not_found'));
 }
 /**
  * @param  $per_page
  * @return mixed
  */
 public function getCompletedTasksPaginated($per_page)
 {
     return Task::completed()->paginate($per_page);
 }
Example #3
0
 /**
  * @return mixed
  */
 public function show($task_id)
 {
     $task = Task::findOrThrowException($task_id);
     return view('backend.quiz.results.show')->withTask($task);
 }
Example #4
0
 /**
  * @param  $id
  * @param  $task_id
  * @param  EditTaskRequest $request
  * @return mixed
  */
 public function task($id, $task_id, EditTaskRequest $request)
 {
     return view('backend.access.task-edit')->withTask(Task::findOrThrowException($task_id))->withPolls(Poll::all()->pluck('title', 'id'));
 }