/** * Handle the command. * * @param CreatePressCommand $command * @return void */ public function handle(CreatePressCommand $command) { $press_object = Press::make(); $press = $this->repo->save($press_object); Event::fire(new PressWasCreated($press)); return $press; }
/** * Handle the command. * * @param UpdatePressCommand $command * @return void */ public function handle(UpdatePressCommand $command) { if ($command->attachment) { $up = new Uploads(); $path = $up->uploadAttachment($command->attachment); } else { $path = $command->path; } $press_object = Press::edit($command->press_id, $command->cover_image_id, $path); $press = $this->repo->save($press_object); Event::fire(new PressWasUpdated($press)); return $press; }
public function getBySlug($slug) { return Press::where('slug', $slug)->first(); }