Пример #1
0
 /**
  * @param CreateTask $request
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function add(CreateTask $request)
 {
     $task = new Task();
     $task->name = $request->name;
     $task->save();
     return redirect('tasks');
 }
Пример #2
0
 /**
  * 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!');
     }
 }
Пример #3
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Guard $auth, Request $request)
 {
     $task = new Task();
     if ($request->get('max_document') <= 0) {
         $request->merge(['max_document' => 500]);
     }
     $task->fill($request->all());
     $task->user_id = $auth->user()->id;
     $task->status = Task::STATUS_RUNNING;
     if ($task->save()) {
         $urlLog = new UrlLog();
         $urlLog->task_id = $task->id;
         $urlLog->url = $request->get('url_index_crawl');
         $urlLog->save();
         shell_exec("nohup php crawlprocess.php --url=" . route('crawl.crawling', ['id' => $task->id]) . " >/dev/null 2>&1 &");
         return redirect()->route('tasks.index');
     }
     return redirect()->back();
 }