/**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Requests\TaskRequest $request)
 {
     $task = new Task();
     $task->fill($request->all());
     $task->created_by = Auth::user()->id;
     if ($task->save()) {
         return redirect('/task/all')->with('success', 'Task created succssfully');
     } else {
         return redirect('/project')->with('error', 'A problem occured, please try again later!');
     }
 }
Example #2
0
 public function update($id, Request $request)
 {
     $task = Task::findOrFail($id);
     $task->name = $request->input('name');
     $task->save();
     return redirect('tasks');
 }
 public function task($id)
 {
     $task = Task::where('id', $id)->get();
     if (empty($task) || count($task) == 0) {
         abort(404);
     } else {
         var_dump($task[0]);
     }
 }
 public function getTexts(Guard $auth, $taskId)
 {
     $task = Task::findOrFail($taskId);
     $texts = TextCrawl::where('task_id', $taskId)->take($task->max_document)->get();
     $title = "crawl/" . $task->id . "_" . \Carbon\Carbon::now()->format('Y-m-d-His') . "_texts.txt";
     foreach ($texts as $text) {
         file_put_contents($title, $text->text . "\n", FILE_APPEND);
     }
     return response()->download($title)->deleteFileAfterSend(true);
 }
Example #5
0
 public function taskaction(\Illuminate\Http\Request $request)
 {
     $task = $request->input('taskouz');
     dump($task);
     foreach ($task as $id) {
         $movie = taskdb::find($id);
         $movie->state = 0;
         $movie->save();
     }
     return Redirect::route('advanced');
 }
 public function sendNotification($taskId)
 {
     $task = Task::findOrFail($taskId);
     $email = $task->user->email;
     $status_code = 201;
     if ($task->status == Task::STATUS_FINISH) {
         $status_code = 200;
         \Mail::send('email.notification-task', ['user' => $task->user, 'taskId' => $taskId], function ($message) use($email, $taskId) {
             $message->from(env('MAIL_FROM_ADDRESS'), env('MAIL_FROM_NAME'));
             $message->to($email);
             $message->subject("Notification Task Crawler #" . $taskId);
         });
     }
 }
Example #7
0
 /**
  * タスク削除(Ajax)
  */
 public function postDelete(Request $request)
 {
     $this->isAjax($request);
     $result = DB::transaction(function () use($request) {
         // タスク削除
         $task = Task::findOrFail($request->id);
         $task->delete();
         return $task->id;
     });
     return \Response::json($result);
 }
 /**
  * Get all of the tasks for a given user.
  *
  * @param  User  $user
  * @return Collection
  */
 public function forUser(User $user)
 {
     return Task::where('user_id', $user->id)->orderBy('created_at', 'asc')->get();
 }