/** * Execute the job. * * @return GuideStep|bool */ public function handle() { $this->step->title = $this->request->input('title', $this->step->title); $this->step->description = $this->request->input('description', $this->step->description); if ($this->step->save()) { // If saving the step is successful, we'll process the file upload if there is one. $file = $this->request->file('image'); if ($file instanceof UploadedFile) { $this->step->deleteFiles(); $this->step->uploadFile($file, $path = null, $resize = true); } return $this->step; } return false; }
/** * Execute the job. * * @return GuideStep|false */ public function handle() { $title = $this->request->input('title'); $description = $this->request->input('description'); $step = $this->guide->addStep($title, $description); // Make sure we've created a step successfully. if ($step instanceof GuideStep) { // Retrieve the image for the step. $file = $this->request->file('image'); if ($file instanceof UploadedFile) { // Looks like an image was uploaded, we'll move // it into storage and add it to the step. $step->uploadFile($file, $path = null, $resize = true); } // No image was uploaded, we'll return the step. return $step; } return false; }