Completed
Push — master ( bf62da...395a1a )
by Christopher
02:52
created
src/Traits/Friendable.php 3 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -231,7 +231,7 @@
 block discarded – undo
231 231
     /**
232 232
      * Get the number of friends
233 233
      *
234
-     * @return \Illuminate\Database\Eloquent\Collection
234
+     * @return integer
235 235
      */
236 236
     public function getFriendsCount()
237 237
     {
Please login to merge, or discard this patch.
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -313,13 +313,13 @@
 block discarded – undo
313 313
 
314 314
 
315 315
         $fofs = Friendship::where('status', Status::ACCEPTED)
316
-                          ->where(function ($query) use ($friendIds) {
317
-                              $query->where(function ($q) use ($friendIds) {
318
-                                  $q->whereIn('sender_id', $friendIds);
319
-                              })->orWhere(function ($q) use ($friendIds) {
320
-                                  $q->whereIn('recipient_id', $friendIds);
321
-                              });
322
-                          })->get(['sender_id', 'recipient_id']);
316
+                            ->where(function ($query) use ($friendIds) {
317
+                                $query->where(function ($q) use ($friendIds) {
318
+                                    $q->whereIn('sender_id', $friendIds);
319
+                                })->orWhere(function ($q) use ($friendIds) {
320
+                                    $q->whereIn('recipient_id', $friendIds);
321
+                                });
322
+                            })->get(['sender_id', 'recipient_id']);
323 323
 
324 324
         $fofIds = array_unique(
325 325
             array_merge($fofs->pluck('sender_id')->all(), $fofs->lists('recipient_id')->all())
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
      */
16 16
     public function befriend(Model $recipient)
17 17
     {
18
-        if (! $this->canBefriend($recipient)) {
18
+        if (!$this->canBefriend($recipient)) {
19 19
             return false;
20 20
         }
21 21
 
@@ -243,7 +243,7 @@  discard block
 block discarded – undo
243 243
         //If sender has a friendship with the recipient return false
244 244
         if ($friendship = $this->getFriendship($recipient)) {
245 245
             //if previous friendship was Denied then let the user send fr
246
-            if (! $friendship->status == Status::DENIED) {
246
+            if (!$friendship->status == Status::DENIED) {
247 247
                 return false;
248 248
             }
249 249
         }
@@ -269,10 +269,10 @@  discard block
 block discarded – undo
269 269
     private function findFriendships($status = '%')
270 270
     {
271 271
         return Friendship::where('status', 'LIKE', $status)
272
-            ->where(function ($query) {
273
-                $query->where(function ($q) {
272
+            ->where(function($query) {
273
+                $query->where(function($q) {
274 274
                     $q->whereSender($this);
275
-                })->orWhere(function ($q) {
275
+                })->orWhere(function($q) {
276 276
                     $q->whereRecipient($this);
277 277
                 });
278 278
             });
@@ -306,10 +306,10 @@  discard block
 block discarded – undo
306 306
         $friendIds = array_unique(array_merge($recipients, $senders));
307 307
 
308 308
         $fofs = Friendship::where('status', Status::ACCEPTED)
309
-                          ->where(function ($query) use ($friendIds) {
310
-                              $query->where(function ($q) use ($friendIds) {
309
+                          ->where(function($query) use ($friendIds) {
310
+                              $query->where(function($q) use ($friendIds) {
311 311
                                   $q->whereIn('sender_id', $friendIds);
312
-                              })->orWhere(function ($q) use ($friendIds) {
312
+                              })->orWhere(function($q) use ($friendIds) {
313 313
                                   $q->whereIn('recipient_id', $friendIds);
314 314
                               });
315 315
                           })->get(['sender_id', 'recipient_id']);
Please login to merge, or discard this patch.
src/database/migrations/create_friendships_table.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 {
8 8
     public function up()
9 9
     {
10
-        Schema::create('friendships', function (Blueprint $table) {
10
+        Schema::create('friendships', function(Blueprint $table) {
11 11
             $table->increments('id');
12 12
             $table->morphs('sender');
13 13
             $table->morphs('recipient');
Please login to merge, or discard this patch.
src/Models/Friendship.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -75,10 +75,10 @@
 block discarded – undo
75 75
      */
76 76
     public function scopeBetweenModels($query, $sender, $recipient)
77 77
     {
78
-        $query->where(function ($queryIn) use ($sender, $recipient) {
79
-            $queryIn->where(function ($q) use ($sender, $recipient) {
78
+        $query->where(function($queryIn) use ($sender, $recipient) {
79
+            $queryIn->where(function($q) use ($sender, $recipient) {
80 80
                 $q->whereSender($sender)->whereRecipient($recipient);
81
-            })->orWhere(function ($q) use ($sender, $recipient) {
81
+            })->orWhere(function($q) use ($sender, $recipient) {
82 82
                 $q->whereSender($recipient)->whereRecipient($sender);
83 83
             });
84 84
         });
Please login to merge, or discard this patch.