コード例 #1
0
 /**
  * Execute the command.
  *
  * @param StartupRepository $repository
  * @return Startup
  */
 public function handle(StartupRepository $repository)
 {
     $startup = Startup::updateStartup($this->startup, $this->data);
     $repository->save($startup);
     if (isset($this->data['tags'])) {
         $repository->updateTags($startup, $this->data['tags']);
     }
     if (isset($this->data['needs'])) {
         $repository->updateNeeds($startup, $this->data['needs']);
     }
     if (isset($this->data['image'])) {
         $repository->updateImage($startup, $this->data['image']);
     }
     return $startup;
 }
コード例 #2
0
 /**
  * Execute the command.
  *
  * @param StartupRepository $repository
  * @return static
  */
 public function handle(StartupRepository $repository)
 {
     $slugify = Slugify::create();
     $startup = Startup::create(['user_id' => $this->user->id, 'name' => $this->startup->name, 'description' => $this->startup->description, 'url' => $slugify->slugify($this->startup->name), 'stage_id' => $this->startup->stage_id, 'video' => $this->startup->video, 'published' => true]);
     $repository->save($startup);
     if (isset($this->startup->tags)) {
         $repository->updateTags($startup, $this->startup->tags);
     }
     if (isset($this->startup->needs)) {
         $repository->updateNeeds($startup, $this->startup->needs);
     }
     if (isset($this->startup->image)) {
         $repository->updateImage($startup, $this->startup->image);
     }
     return $startup;
 }