Last active
January 23, 2017 22:59
-
-
Save Mulkave/943d6820843039f2c96aa496f284c175 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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