@@ -18,7 +18,7 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | protected function saveFiles($model) |
| 20 | 20 | { |
| 21 | - if (! in_array(StorageTrait::class, class_uses($model))) { |
|
| 21 | + if (!in_array(StorageTrait::class, class_uses($model))) { |
|
| 22 | 22 | throw new InvalidArgumentException('The model you used does not use the Storage trait'); |
| 23 | 23 | } |
| 24 | 24 | |
@@ -53,9 +53,9 @@ |
||
| 53 | 53 | if ($this->image) { |
| 54 | 54 | if ($this->user->image()->exists()) { |
| 55 | 55 | $fileName = $this->user->image->name; |
| 56 | - $this->uploadImages($this->user, [$this->image], $imageManager, $fileName); |
|
| 56 | + $this->uploadImages($this->user, [ $this->image ], $imageManager, $fileName); |
|
| 57 | 57 | } else { |
| 58 | - $this->uploadImages($this->user, [$this->image], $imageManager); |
|
| 58 | + $this->uploadImages($this->user, [ $this->image ], $imageManager); |
|
| 59 | 59 | } |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | protected function processImage(ImageManager $imageManager, $model) |
| 19 | 19 | { |
| 20 | - if (! in_array(StorageTrait::class, class_uses($model))) { |
|
| 20 | + if (!in_array(StorageTrait::class, class_uses($model))) { |
|
| 21 | 21 | throw new InvalidArgumentException('The model you used does not use the Storage trait'); |
| 22 | 22 | } |
| 23 | 23 | |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | $imageManager |
| 36 | 36 | ->make($originalFile) |
| 37 | 37 | ->fit($thumbNailsDimension, $thumbNailsDimension, |
| 38 | - function ($constraint) { |
|
| 38 | + function($constraint) { |
|
| 39 | 39 | $constraint->upsize(); |
| 40 | 40 | $constraint->aspectRatio(); |
| 41 | 41 | }, 'center') |
@@ -27,16 +27,16 @@ discard block |
||
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | $paths = [ |
| 30 | - 'local' => $server.'/storage/'.$folder, |
|
| 31 | - 'production' => config('faithgen-sdk.faithgen-cloudfront').$folder, |
|
| 30 | + 'local' => $server . '/storage/' . $folder, |
|
| 31 | + 'production' => config('faithgen-sdk.faithgen-cloudfront') . $folder, |
|
| 32 | 32 | ]; |
| 33 | 33 | |
| 34 | - $path = $paths[App::environment()]; |
|
| 34 | + $path = $paths[ App::environment() ]; |
|
| 35 | 35 | |
| 36 | - return (object) [ |
|
| 37 | - '_50' => $path.'/50-50/'.$imageName, |
|
| 38 | - '_100' => $path.'/100-100/'.$imageName, |
|
| 39 | - 'original' => $path.'/original/'.$imageName, |
|
| 36 | + return (object)[ |
|
| 37 | + '_50' => $path . '/50-50/' . $imageName, |
|
| 38 | + '_100' => $path . '/100-100/' . $imageName, |
|
| 39 | + 'original' => $path . '/original/' . $imageName, |
|
| 40 | 40 | ]; |
| 41 | 41 | } |
| 42 | 42 | |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | $protocol = 'https://'; |
| 54 | 54 | } |
| 55 | 55 | |
| 56 | - return (object) [ |
|
| 57 | - '_50' => $protocol.$_SERVER['HTTP_HOST'].'/images/logo-50.png', |
|
| 58 | - '_100' => $protocol.$_SERVER['HTTP_HOST'].'/images/logo-100.png', |
|
| 59 | - 'original' => $protocol.$_SERVER['HTTP_HOST'].'/images/logo-original.png', |
|
| 56 | + return (object)[ |
|
| 57 | + '_50' => $protocol . $_SERVER[ 'HTTP_HOST' ] . '/images/logo-50.png', |
|
| 58 | + '_100' => $protocol . $_SERVER[ 'HTTP_HOST' ] . '/images/logo-100.png', |
|
| 59 | + 'original' => $protocol . $_SERVER[ 'HTTP_HOST' ] . '/images/logo-original.png', |
|
| 60 | 60 | ]; |
| 61 | 61 | } |
| 62 | 62 | |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | */ |
| 72 | 72 | public static function getImage(string $folder, ?Image $image, ?string $server = null) |
| 73 | 73 | { |
| 74 | - if (! $server) { |
|
| 74 | + if (!$server) { |
|
| 75 | 75 | $server = config('faithgen-sdk.ministries-server'); |
| 76 | 76 | } |
| 77 | 77 | |
@@ -20,22 +20,22 @@ |
||
| 20 | 20 | */ |
| 21 | 21 | protected function uploadImages($model, array $images, ImageManager $imageManager, string $fileName = null) |
| 22 | 22 | { |
| 23 | - if (! in_array(StorageTrait::class, class_uses($model))) { |
|
| 23 | + if (!in_array(StorageTrait::class, class_uses($model))) { |
|
| 24 | 24 | throw new InvalidArgumentException('The model you used does not use the Storage trait'); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | - if (! in_array(ImageableTrait::class, class_uses($model))) { |
|
| 27 | + if (!in_array(ImageableTrait::class, class_uses($model))) { |
|
| 28 | 28 | throw new InvalidArgumentException('The model you used does not use the Imageable trait'); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | foreach ($images as $imageData) { |
| 32 | - if (! $fileName) { |
|
| 33 | - $fileName = str_shuffle($model->id.time().time()).'.png'; |
|
| 32 | + if (!$fileName) { |
|
| 33 | + $fileName = str_shuffle($model->id . time() . time()) . '.png'; |
|
| 34 | 34 | } else { |
| 35 | 35 | $this->isNew = false; |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | - $ogSave = storage_path('app/public/'.$model->filesDir().'/original/').$fileName; |
|
| 38 | + $ogSave = storage_path('app/public/' . $model->filesDir() . '/original/') . $fileName; |
|
| 39 | 39 | |
| 40 | 40 | try { |
| 41 | 41 | $imageManager->make($imageData)->save($ogSave); |
@@ -39,6 +39,6 @@ |
||
| 39 | 39 | */ |
| 40 | 40 | public function getUnsetFields(): array |
| 41 | 41 | { |
| 42 | - return ['image_id']; |
|
| 42 | + return [ 'image_id' ]; |
|
| 43 | 43 | } |
| 44 | 44 | } |
@@ -33,6 +33,6 @@ |
||
| 33 | 33 | */ |
| 34 | 34 | public function getUnsetFields(): array |
| 35 | 35 | { |
| 36 | - return ['name', 'email', 'phone']; |
|
| 36 | + return [ 'name', 'email', 'phone' ]; |
|
| 37 | 37 | } |
| 38 | 38 | } |
@@ -6,26 +6,26 @@ |
||
| 6 | 6 | use FaithGen\SDK\Http\Controllers\ReviewController; |
| 7 | 7 | use Illuminate\Support\Facades\Route; |
| 8 | 8 | |
| 9 | -Route::name('ministry.')->prefix('ministry/')->group(function () { |
|
| 10 | - Route::post('social-link', [MinistryController::class, 'getSocialLink']); |
|
| 11 | - Route::get('profile', [MinistryController::class, 'getProfile']); |
|
| 12 | - Route::get('account-type', [MinistryController::class, 'accountType']); |
|
| 9 | +Route::name('ministry.')->prefix('ministry/')->group(function() { |
|
| 10 | + Route::post('social-link', [ MinistryController::class, 'getSocialLink' ]); |
|
| 11 | + Route::get('profile', [ MinistryController::class, 'getProfile' ]); |
|
| 12 | + Route::get('account-type', [ MinistryController::class, 'accountType' ]); |
|
| 13 | 13 | }); |
| 14 | 14 | |
| 15 | -Route::name('images.')->prefix('images')->group(function () { |
|
| 16 | - Route::post('comment/{image}', [ImageController::class, 'comment']); |
|
| 17 | - Route::get('comments/{image}', [ImageController::class, 'comments']); |
|
| 15 | +Route::name('images.')->prefix('images')->group(function() { |
|
| 16 | + Route::post('comment/{image}', [ ImageController::class, 'comment' ]); |
|
| 17 | + Route::get('comments/{image}', [ ImageController::class, 'comments' ]); |
|
| 18 | 18 | }); |
| 19 | 19 | |
| 20 | 20 | Route::prefix('reviews') |
| 21 | - ->group(function () { |
|
| 22 | - Route::post('', [ReviewController::class, 'sendReview']); |
|
| 21 | + ->group(function() { |
|
| 22 | + Route::post('', [ ReviewController::class, 'sendReview' ]); |
|
| 23 | 23 | }); |
| 24 | 24 | |
| 25 | -if (! config('faithgen-sdk.source')) { |
|
| 25 | +if (!config('faithgen-sdk.source')) { |
|
| 26 | 26 | Route::prefix('comments') |
| 27 | - ->group(function () { |
|
| 28 | - Route::post('presence', [CommentController::class, 'presenceRegister']); |
|
| 29 | - Route::post('typing', [CommentController::class, 'showTyping']); |
|
| 27 | + ->group(function() { |
|
| 28 | + Route::post('presence', [ CommentController::class, 'presenceRegister' ]); |
|
| 29 | + Route::post('typing', [ CommentController::class, 'showTyping' ]); |
|
| 30 | 30 | }); |
| 31 | 31 | } |
@@ -21,13 +21,13 @@ |
||
| 21 | 21 | $modelName = $routeModel->keys()->first(); |
| 22 | 22 | |
| 23 | 23 | $binding = collect(app()->getBindings()) |
| 24 | - ->filter(function ($binding, $key) use ($modelName) { |
|
| 25 | - return Str::contains($key, '\\'.ucfirst($modelName)) && Str::endsWith($key, 'Service'); |
|
| 24 | + ->filter(function($binding, $key) use ($modelName) { |
|
| 25 | + return Str::contains($key, '\\' . ucfirst($modelName)) && Str::endsWith($key, 'Service'); |
|
| 26 | 26 | }) |
| 27 | 27 | ->keys() |
| 28 | 28 | ->first(); |
| 29 | 29 | |
| 30 | - $modelMethod = 'get'.ucwords($modelName); |
|
| 30 | + $modelMethod = 'get' . ucwords($modelName); |
|
| 31 | 31 | |
| 32 | 32 | return $this->user()->can('view', app($binding)->$modelMethod()); |
| 33 | 33 | } |