Exemplo n.º 1
0
 /**
  * Execute the job.
  *
  * @return int
  */
 public function handle()
 {
     $images = $this->request->file('images');
     $uploaded = 0;
     foreach ($images as $image) {
         if ($image instanceof UploadedFile) {
             $step = $this->guide->addStep($image->getClientOriginalName());
             if ($step instanceof GuideStep) {
                 if ($step->uploadFile($image, $path = null, $resize = true)) {
                     $uploaded++;
                 }
             }
         }
     }
     return $uploaded;
 }
Exemplo n.º 2
0
 /**
  * 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;
 }