/** * Handle the command * * @param $command * @return mixed */ public function handle($command) { $client = S3Client::factory(array('key' => $this->config->get('services.s3.key'), 'secret' => $this->config->get('services.s3.secret'))); /* * Delete image from S3 */ $filesystem = new Flysystem(new Adapter($client, $this->config->get('sightseeing.s3-bucket'))); $image = $this->sightRepository->getImageById($command->imageId); $filesystem->delete($image->path); /* * Delete DB record */ $this->sightRepository->deleteImageById($command->imageId); }
public function showImage($imageId) { $image = $this->sightRepository->getImageById($imageId); $sight = $image->sight; return \View::make('sights.image')->with('title', 'Editing image')->with('image', $image)->with('sight', $sight); }