예제 #1
0
 /**
  * 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;
 }
예제 #2
0
파일: Store.php 프로젝트: stevebauman/ithub
 /**
  * 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;
 }
예제 #3
0
 /**
  * Updates the specified guide step.
  *
  * @param GuideStepRequest $request
  * @param int|string       $id
  * @param int              $stepPosition
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update(GuideStepRequest $request, $id, $stepPosition)
 {
     $guide = $this->guide->locate($id);
     $step = $guide->findStepByPosition($stepPosition);
     if ($request->persist($guide, $step)) {
         flash()->success('Success!', 'Successfully updated step.');
         if ($request->input('action') === 'multiple') {
             return redirect()->route('resources.guides.steps.create', [$id]);
         }
         return redirect()->route('resources.guides.steps.index', [$id]);
     }
     flash()->error('Error!', 'There was an issue updating this step. Please try again.');
     return redirect()->route('resources.guides.steps.edit', [$id, $stepPosition]);
 }