/** * Execute the job. * * @return void */ public function handle(CreateVideoRequest $request) { // Change spaces to dashes and lowecase the value $this->permalinkTrait($this->request['permalink']); // Create Correct Date and Time Format $this->setCreatedAtTime($this->request['date'], $this->request['time']); // Save Form Data to database $video = Video::create($this->request); // Adds tags to post if (isset($this->request['tag_list']) && $this->request['tag_list'] != []) { $video->tags()->sync($this->request['tag_list']); } // Set image to session if ($request->hasFile('image')) { session()->put('image', $request->image); } // Launch Event event(new SavedVideo($video, 'created')); }
/** * Store a newly created video in storage. * * @param \Illuminate\Http\Request $request * @return Response */ public function store(CreateVideoRequest $request) { $this->dispatch(new CreateVideo($request->except('image'))); return redirect()->route('admin.videos.index'); }