Passed
Push — master ( be3cdd...180558 )
by Innocent
03:36
created
src/Http/Controllers/MinistryController.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     public function getSocialLink(GetRequest $request)
59 59
     {
60 60
         return response()->json([
61
-            'link' => auth()->user()->profile[$request->platform],
61
+            'link' => auth()->user()->profile[ $request->platform ],
62 62
         ]);
63 63
     }
64 64
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
     public function saveSocialLink(UpdateRequest $request)
73 73
     {
74 74
         $profile = auth()->user()->profile;
75
-        $profile[$request->platform] = $request->link;
75
+        $profile[ $request->platform ] = $request->link;
76 76
         try {
77 77
             $profile->save();
78 78
 
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
             $this->deleteFiles(auth()->user());
116 116
         }
117 117
 
118
-        $fileName = str_shuffle(auth()->user()->id.time().time()).'.png';
119
-        $ogSave = storage_path('app/public/profile/original/').$fileName;
118
+        $fileName = str_shuffle(auth()->user()->id . time() . time()) . '.png';
119
+        $ogSave = storage_path('app/public/profile/original/') . $fileName;
120 120
         $imageManager->make($request->image)->save($ogSave);
121
-        $image = auth()->user()->image()->updateOrCreate([], [
121
+        $image = auth()->user()->image()->updateOrCreate([ ], [
122 122
             'name' => $fileName,
123 123
         ]);
124 124
 
@@ -186,27 +186,27 @@  discard block
 block discarded – undo
186 186
      */
187 187
     public function updateProfile(UpdateProfileRequest $request)
188 188
     {
189
-        $ministryParams = $request->only(['name', 'email', 'phone']);
189
+        $ministryParams = $request->only([ 'name', 'email', 'phone' ]);
190 190
 
191 191
         auth()->user()->update($ministryParams);
192 192
 
193
-        $links = ['website', 'facebook', 'youtube', 'twitter', 'instagram'];
194
-        $statements = ['vision', 'mission', 'about_us'];
193
+        $links = [ 'website', 'facebook', 'youtube', 'twitter', 'instagram' ];
194
+        $statements = [ 'vision', 'mission', 'about_us' ];
195 195
 
196
-        $params = ['color' => $request->color];
196
+        $params = [ 'color' => $request->color ];
197 197
 
198 198
         $params = array_merge($params,
199
-            array_filter($request->links, fn ($link) => in_array($link, $links), ARRAY_FILTER_USE_KEY));
199
+            array_filter($request->links, fn($link) => in_array($link, $links), ARRAY_FILTER_USE_KEY));
200 200
 
201 201
         $params = array_merge($params,
202
-            array_filter($request->statement, fn ($link) => in_array($link, $statements), ARRAY_FILTER_USE_KEY));
202
+            array_filter($request->statement, fn($link) => in_array($link, $statements), ARRAY_FILTER_USE_KEY));
203 203
 
204
-        $params = array_merge($params, ['emails' => $request->emails]);
204
+        $params = array_merge($params, [ 'emails' => $request->emails ]);
205 205
 
206
-        $params = array_merge($params, ['phones' => $request->phones]);
206
+        $params = array_merge($params, [ 'phones' => $request->phones ]);
207 207
 
208 208
         if ($request->has('location')) {
209
-            $params = array_merge($params, ['location' => $request->location]);
209
+            $params = array_merge($params, [ 'location' => $request->location ]);
210 210
         }
211 211
 
212 212
         $this->saveServices($request, auth()->user());
@@ -227,9 +227,9 @@  discard block
 block discarded – undo
227 227
                 ->whereIn('id', $ministry->services()->pluck('id')->toArray())
228 228
                 ->delete();
229 229
 
230
-            $services = array_map(function ($service) {
230
+            $services = array_map(function($service) {
231 231
                 return array_merge($service, [
232
-                    'id'          => str_shuffle((string) Str::uuid()),
232
+                    'id'          => str_shuffle((string)Str::uuid()),
233 233
                     'ministry_id' => auth()->user()->id,
234 234
                     'created_at'  => now(),
235 235
                     'updated_at'  => now(),
@@ -248,7 +248,7 @@  discard block
 block discarded – undo
248 248
      */
249 249
     public function getLinks($links)
250 250
     {
251
-        $_links = ['website', 'facebook', 'youtube', 'twitter', 'instagram'];
251
+        $_links = [ 'website', 'facebook', 'youtube', 'twitter', 'instagram' ];
252 252
 
253 253
         return array_key_exists($links, $_links);
254 254
     }
@@ -276,8 +276,8 @@  discard block
 block discarded – undo
276 276
             ->ministryUsers()
277 277
             ->latest()
278 278
             //->with(['user.image'])
279
-            ->where(fn ($ministryUser) => $ministryUser->whereHas('user',
280
-                fn ($user) => $user->search(['name', 'email'], $request->filter_text)))
279
+            ->where(fn($ministryUser) => $ministryUser->whereHas('user',
280
+                fn($user) => $user->search([ 'name', 'email' ], $request->filter_text)))
281 281
             ->paginate(Helper::getLimit($request));
282 282
 
283 283
         //return $ministryUsers;
Please login to merge, or discard this patch.
src/Http/Resources/Ministry.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
18 18
     {
19 19
         $results = parent::toArray($request);
20 20
         $results = array_merge($results, [
21
-            'active' => (bool) optional($this->activation)->active,
21
+            'active' => (bool)optional($this->activation)->active,
22 22
             'avatar' => ImageHelper::getImage('profile', $this->image),
23 23
             'level'  => optional($this->account)->level,
24 24
         ]);
Please login to merge, or discard this patch.
src/Traits/FileTraits.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,40 +8,40 @@
 block discarded – undo
8 8
 
9 9
 trait FileTraits
10 10
 {
11
-    private $dimensions = [0, 50, 100];
11
+    private $dimensions = [ 0, 50, 100 ];
12 12
 
13 13
     public function getFileName(string $path)
14 14
     {
15 15
         $pieces = explode('/', $path);
16 16
 
17
-        return $pieces[count($pieces) - 1];
17
+        return $pieces[ count($pieces) - 1 ];
18 18
     }
19 19
 
20 20
     public function getImage(string $dir, string $imageName, int $dimen = 0)
21 21
     {
22 22
         if ($dimen) {
23
-            $dimen = $dimen.'-'.$dimen.'/';
23
+            $dimen = $dimen . '-' . $dimen . '/';
24 24
         } else {
25 25
             $dimen = 'original/';
26 26
         }
27 27
 
28
-        return storage_path('app/public/'.$dir.'/'.$dimen.$imageName);
28
+        return storage_path('app/public/' . $dir . '/' . $dimen . $imageName);
29 29
     }
30 30
 
31
-    public function getImages(string $dir, string $fileName, $dimensions = [])
31
+    public function getImages(string $dir, string $fileName, $dimensions = [ ])
32 32
     {
33
-        if (! count($dimensions)) {
33
+        if (!count($dimensions)) {
34 34
             $dimensions = $this->dimensions;
35 35
         }
36 36
 
37 37
         return collect($dimensions)
38
-            ->map(fn ($dimension) => $this->getImage($dir, $fileName, $dimension))
38
+            ->map(fn($dimension) => $this->getImage($dir, $fileName, $dimension))
39 39
             ->toArray();
40 40
     }
41 41
 
42 42
     public function deleteFiles($model)
43 43
     {
44
-        $images = [];
44
+        $images = [ ];
45 45
         foreach ($model->getImageDimensions() as $imageDimension) {
46 46
             if (is_string($model->getFileName())) {
47 47
                 array_push($images, $this->getImage($model->filesDir(), $model->getFileName(), $imageDimension));
Please login to merge, or discard this patch.
src/Traits/SavesToAmazonS3.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/Traits/UploadsImages.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -20,20 +20,20 @@
 block discarded – undo
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
                 $this->isNew = false;
35 35
             }
36
-            $ogSave = storage_path('app/public/'.$model->filesDir().'/original/').$fileName;
36
+            $ogSave = storage_path('app/public/' . $model->filesDir() . '/original/') . $fileName;
37 37
             try {
38 38
                 $imageManager->make($imageData)->save($ogSave);
39 39
 
Please login to merge, or discard this patch.
src/Jobs/Users/UploadImage.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -53,9 +53,9 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Traits/ProcessesImages.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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')
Please login to merge, or discard this patch.
src/Helpers/ImageHelper.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -27,16 +27,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 
Please login to merge, or discard this patch.