Skip to content

Instantly share code, notes, and snippets.

@Mulkave
Last active January 23, 2017 22:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mulkave/943d6820843039f2c96aa496f284c175 to your computer and use it in GitHub Desktop.
Save Mulkave/943d6820843039f2c96aa496f284c175 to your computer and use it in GitHub Desktop.
<?php
class UpdateArticleFeature extends Feature
{
public function handle(Request $request)
{
$this->run(new ValidateArticleInputForUpdateJob($request->input()));
// process cover photo
$photo = $this->run(MakePhotoFromDataJob::class, ['data' => $request->input('photo')]);
$this->run(new ValidateCoverPhotoDimensionsJob($photo));
$variations = $this->run(new GeneratePhotoVariationsJob($photo));
$uploads = $this->run(new UploadFilesToCdnJob($variations));
$cover = $this->run(new MakeCoverFromVariationUploadsJob($uploads));
$this->run(CleanFilesInDirectoryJob::class, [
'files' => $variations,
'directory' => $this->run(GetImagesStorageLocationJob::class),
]);
// save article
$article = $this->run(UpdateArticleJob::class, [
'cover' => $cover,
'title' => $request->input('title'),
'body' => $request->input('body'),
]);
return $this->run(new RespondWithJsonJob($article));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment