Completed
Push — master ( 28284e...eaa9bf )
by
unknown
12:07
created
app/Repositories/LotDeliveryPaymentRepository.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
 class LotDeliveryPaymentRepository extends Repository
8 8
 {
9 9
     /**
10
-     * @return Banner
10
+     * @return LotDeliveryPayment
11 11
      */
12 12
     public function getModel()
13 13
     {
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
      * Get ad-blocks for extended banners block.
19 19
      *
20 20
      * @param $count
21
-     * @return mixed
21
+     * @return boolean
22 22
      */
23 23
     public function save($lot, array $data)
24 24
     {
Please login to merge, or discard this patch.
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@
 block discarded – undo
24 24
     {
25 25
         $model = self::getModel();
26 26
         $model->where('lot_id', $lot->id)->delete();
27
-        $insert = []; $i = 0;
27
+        $insert = [ ]; $i = 0;
28 28
         if (!empty($data)) {
29 29
             foreach ($data as $key1 => $method) {
30 30
                 foreach ($method as $key2 => $item) {
31
-                    $insert[$i]['lot_id']      = $lot->id;
32
-                    $insert[$i]['method_id']   = (int)$item;
33
-                    $insert[$i]['method_type'] = $key1;
31
+                    $insert[ $i ][ 'lot_id' ]      = $lot->id;
32
+                    $insert[ $i ][ 'method_id' ]   = (int) $item;
33
+                    $insert[ $i ][ 'method_type' ] = $key1;
34 34
                     $i++;
35 35
                 }
36 36
 
Please login to merge, or discard this patch.
app/Repositories/LotRepository.php 3 patches
Doc Comments   +10 added lines, -7 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      * Create plain lot for attached items to him.
21 21
      *
22 22
      * @param Vendor $vendor
23
-     * @return mixed
23
+     * @return Lot
24 24
      */
25 25
     public function createDraft(Vendor $vendor)
26 26
     {
@@ -49,8 +49,8 @@  discard block
 block discarded – undo
49 49
     /**
50 50
      * Add empty lot or modify just existed (drafted)..
51 51
      *
52
-     * @param $vendor
53
-     * @return Lot|mixed
52
+     * @param Vendor $vendor
53
+     * @return Lot
54 54
      */
55 55
     public function addLot($vendor)
56 56
     {
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
     /**
82 82
      * Get user's lots.
83 83
      *
84
-     * @param $user
84
+     * @param \Illuminate\Contracts\Auth\Authenticatable|null $user
85 85
      * @param $perPage
86 86
      * @return \Illuminate\Support\Collection|null
87 87
      */
@@ -130,7 +130,7 @@  discard block
 block discarded – undo
130 130
     /**
131 131
      * Delete lot.
132 132
      *
133
-     * @param $lot
133
+     * @param Lot $lot
134 134
      */
135 135
     public function delete($lot)
136 136
     {
@@ -147,7 +147,7 @@  discard block
 block discarded – undo
147 147
      * Convert string date to \Carbon/Carbon timestamp.
148 148
      *
149 149
      * @param $date
150
-     * @return static
150
+     * @return Carbon
151 151
      */
152 152
     public function dateToTimestamp($date)
153 153
     {
@@ -181,6 +181,9 @@  discard block
 block discarded – undo
181 181
         return $new_date;
182 182
     }
183 183
 
184
+    /**
185
+     * @param Lot $lot
186
+     */
184 187
     public function save($lot, array $data)
185 188
     {
186 189
         $lot->fill([
@@ -202,7 +205,7 @@  discard block
 block discarded – undo
202 205
     /**
203 206
      * Change category.
204 207
      *
205
-     * @param $lot
208
+     * @param Lot $lot
206 209
      * @param $category_id
207 210
      *
208 211
      * @return void
Please login to merge, or discard this patch.
Spacing   +31 added lines, -31 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
             ->first();
43 43
     }
44 44
 
45
-    public function statusChange(){
45
+    public function statusChange() {
46 46
 
47 47
     }
48 48
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
      */
55 55
     public function addLot($vendor)
56 56
     {
57
-        if($lot = $this->getDraftedLot($vendor))
57
+        if ($lot = $this->getDraftedLot($vendor))
58 58
             return $lot;
59 59
 
60 60
         return $this->createDraft($vendor);
@@ -70,7 +70,7 @@  discard block
 block discarded – undo
70 70
     {
71 71
         $query = $this->getModel();
72 72
 
73
-        if($vendor)
73
+        if ($vendor)
74 74
             $query = $query->where('vendor_id', $vendor->id);
75 75
 
76 76
         $lot = $query->drafted()->first();
@@ -89,11 +89,11 @@  discard block
 block discarded – undo
89 89
     {
90 90
         $model = self::getModel();
91 91
 
92
-        $vendors = [];
92
+        $vendors = [ ];
93 93
 
94 94
         $user->vendors()->active()->get()
95 95
             ->each(function($vendor) use (&$vendors){
96
-                $vendors[] = $vendor->id;
96
+                $vendors[ ] = $vendor->id;
97 97
             });
98 98
 
99 99
         $lots = $this->getModel()
@@ -106,25 +106,25 @@  discard block
 block discarded – undo
106 106
         return ($lots->count()) ? $lots : null;
107 107
     }
108 108
 
109
-    public function userLotsPendingComision($user,$lotId=null)
109
+    public function userLotsPendingComision($user, $lotId = null)
110 110
     {
111 111
 
112 112
         $model = self::getModel();
113 113
 
114
-        $vendors = [];
114
+        $vendors = [ ];
115 115
         $user->vendors()->active()->get()
116 116
             ->each(function($vendor) use (&$vendors){
117
-                $vendors[] = $vendor->id;
117
+                $vendors[ ] = $vendor->id;
118 118
             });
119 119
         $query = $this->getModel()->where('verify_status', $model::STATUS_VERIFY_PENDING);
120 120
         if (!empty($vendors)) {
121 121
             $query->whereIn('vendor_id', $vendors);
122 122
         }
123 123
         if ($lotId != null) {
124
-            $query->where('id','!=', $lotId);
124
+            $query->where('id', '!=', $lotId);
125 125
         }
126 126
         $sum = $query->sum('comision');
127
-        return  $sum ? (int)$sum : 0;
127
+        return  $sum ? (int) $sum : 0;
128 128
     }
129 129
 
130 130
     /**
@@ -135,7 +135,7 @@  discard block
 block discarded – undo
135 135
     public function delete($lot)
136 136
     {
137 137
         $model = self::getModel();
138
-        if($lot->status !== $model::STATUS_DELETED)
138
+        if ($lot->status !== $model::STATUS_DELETED)
139 139
         {
140 140
             $lot->status = $model::STATUS_DELETED;
141 141
 
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
     {
154 154
         $dates = $this->reformatDateString($date);
155 155
 
156
-        return Carbon::createFromDate($dates['y'], $dates['m'], $dates['d']);
156
+        return Carbon::createFromDate($dates[ 'y' ], $dates[ 'm' ], $dates[ 'd' ]);
157 157
     }
158 158
 
159 159
     /**
@@ -167,15 +167,15 @@  discard block
 block discarded – undo
167 167
     {
168 168
         $datas = explode($delimiter, $date);
169 169
 
170
-        if(count($datas) == 3) {
171
-            $new_date['d'] = $datas[0];
172
-            $new_date['m'] = $datas[1];
173
-            $new_date['y'] = $datas[2];
170
+        if (count($datas) == 3) {
171
+            $new_date[ 'd' ] = $datas[ 0 ];
172
+            $new_date[ 'm' ] = $datas[ 1 ];
173
+            $new_date[ 'y' ] = $datas[ 2 ];
174 174
         } else {
175 175
             $now = Carbon::now();
176
-            $new_date['d'] = $now->day;
177
-            $new_date['m'] = $now->month;
178
-            $new_date['y'] = $now->year;
176
+            $new_date[ 'd' ] = $now->day;
177
+            $new_date[ 'm' ] = $now->month;
178
+            $new_date[ 'y' ] = $now->year;
179 179
         }
180 180
 
181 181
         return $new_date;
@@ -184,16 +184,16 @@  discard block
 block discarded – undo
184 184
     public function save($lot, array $data)
185 185
     {
186 186
         $lot->fill([
187
-            'name'                 => isset($data['name']) ? $data['name'] : $lot->present()->renderDraftedName(),
188
-            'category_id'          => isset($data['category']) ? $data['category'] : null,
189
-            'currency_id'          => isset($data['currency']) ? (int)$data['currency'] : null,
190
-            'description'          => isset($data['description']) ? $data['description'] : null,
191
-            'yield_amount'         => isset($data['yield_amount']) ? $data['yield_amount'] : null,
192
-            'public_date'          => isset($data['public_date']) ? $this->dateToTimestamp($data['public_date']) : Carbon::now()->addDays(1),
193
-            'expire_date'          => isset($data['expirate_date']) ? $this->dateToTimestamp($data['expirate_date']) :Carbon::now()->addDays(5),
194
-            'comision'             => isset($data['comision']) ? $data['comision'] : 0,
195
-            'description_delivery' => isset($data['description_delivery']) ? $data['description_delivery'] : null,
196
-            'description_payment'  => isset($data['description_payment']) ? $data['description_payment'] : null,
187
+            'name'                 => isset($data[ 'name' ]) ? $data[ 'name' ] : $lot->present()->renderDraftedName(),
188
+            'category_id'          => isset($data[ 'category' ]) ? $data[ 'category' ] : null,
189
+            'currency_id'          => isset($data[ 'currency' ]) ? (int) $data[ 'currency' ] : null,
190
+            'description'          => isset($data[ 'description' ]) ? $data[ 'description' ] : null,
191
+            'yield_amount'         => isset($data[ 'yield_amount' ]) ? $data[ 'yield_amount' ] : null,
192
+            'public_date'          => isset($data[ 'public_date' ]) ? $this->dateToTimestamp($data[ 'public_date' ]) : Carbon::now()->addDays(1),
193
+            'expire_date'          => isset($data[ 'expirate_date' ]) ? $this->dateToTimestamp($data[ 'expirate_date' ]) : Carbon::now()->addDays(5),
194
+            'comision'             => isset($data[ 'comision' ]) ? $data[ 'comision' ] : 0,
195
+            'description_delivery' => isset($data[ 'description_delivery' ]) ? $data[ 'description_delivery' ] : null,
196
+            'description_payment'  => isset($data[ 'description_payment' ]) ? $data[ 'description_payment' ] : null,
197 197
         ])->save();
198 198
         return $lot;
199 199
     }
@@ -222,7 +222,7 @@  discard block
 block discarded – undo
222 222
      */
223 223
     public function checkIfPossibleToChangeCategory(Lot $lot)
224 224
     {
225
-        if(! count($lot->products))
225
+        if (!count($lot->products))
226 226
             return true;
227 227
 
228 228
         return false;
@@ -231,7 +231,7 @@  discard block
 block discarded – undo
231 231
     public function getLatestLot($limit = 10)
232 232
     {
233 233
         return self::getModel()
234
-            ->orderBy('id','DESC')
234
+            ->orderBy('id', 'DESC')
235 235
             ->active()
236 236
             ->limit($limit)
237 237
             ->get();
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -32,10 +32,11 @@  discard block
 block discarded – undo
32 32
 
33 33
     public function find($slug)
34 34
     {
35
-        if (is_numeric($slug))
36
-            return $this->getModel()
35
+        if (is_numeric($slug)) {
36
+                    return $this->getModel()
37 37
                 ->whereId((int) $slug)
38 38
                 ->first();
39
+        }
39 40
 
40 41
         return $this->getModel()
41 42
             ->whereSlug($slug)
@@ -54,8 +55,9 @@  discard block
 block discarded – undo
54 55
      */
55 56
     public function addLot($vendor)
56 57
     {
57
-        if($lot = $this->getDraftedLot($vendor))
58
-            return $lot;
58
+        if($lot = $this->getDraftedLot($vendor)) {
59
+                    return $lot;
60
+        }
59 61
 
60 62
         return $this->createDraft($vendor);
61 63
     }
@@ -70,8 +72,9 @@  discard block
 block discarded – undo
70 72
     {
71 73
         $query = $this->getModel();
72 74
 
73
-        if($vendor)
74
-            $query = $query->where('vendor_id', $vendor->id);
75
+        if($vendor) {
76
+                    $query = $query->where('vendor_id', $vendor->id);
77
+        }
75 78
 
76 79
         $lot = $query->drafted()->first();
77 80
 
@@ -222,8 +225,9 @@  discard block
 block discarded – undo
222 225
      */
223 226
     public function checkIfPossibleToChangeCategory(Lot $lot)
224 227
     {
225
-        if(! count($lot->products))
226
-            return true;
228
+        if(! count($lot->products)) {
229
+                    return true;
230
+        }
227 231
 
228 232
         return false;
229 233
     }
Please login to merge, or discard this patch.
app/Repositories/MethodDeliveryPaymentRepository.php 1 patch
Doc Comments   +1 added lines patch added patch discarded remove patch
@@ -27,6 +27,7 @@
 block discarded – undo
27 27
      * Get public posts.
28 28
      *
29 29
      * @param $perPage
30
+     * @param string $type
30 31
      * @return \Illuminate\Database\Eloquent\Collection
31 32
      */
32 33
     public function getPublic($type)
Please login to merge, or discard this patch.
app/Repositories/ModelColorsRepository.php 3 patches
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -38,6 +38,9 @@
 block discarded – undo
38 38
         return $color;
39 39
     }
40 40
 
41
+    /**
42
+     * @param integer $slug
43
+     */
41 44
     public function find($slug)
42 45
     {
43 46
         if (is_numeric($slug))
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -15,25 +15,25 @@  discard block
 block discarded – undo
15 15
         return new Color();
16 16
     }
17 17
 
18
-    public function create(array $data,$specSize)
18
+    public function create(array $data, $specSize)
19 19
     {
20 20
         return self::getModel()
21 21
             ->create([
22 22
                 'size_id'    => $specSize->id,
23 23
                 'product_id' => $specSize->product_id,
24
-                'color_hash' => (isset($data['color_hash']) ? $data['color_hash'] : ''),
25
-                'amount'     => (isset($data['amount']) ? $data['amount'] : '')
24
+                'color_hash' => (isset($data[ 'color_hash' ]) ? $data[ 'color_hash' ] : ''),
25
+                'amount'     => (isset($data[ 'amount' ]) ? $data[ 'amount' ] : '')
26 26
             ]);
27 27
     }
28 28
     public function save(array $data, $specSize)
29 29
     {
30
-        $key = ((isset($data['key']) &&  $data['key'] != null) ? $data['key'] : null);
30
+        $key = ((isset($data[ 'key' ]) && $data[ 'key' ] != null) ? $data[ 'key' ] : null);
31 31
         $color             = self::getModel()->firstOrNew(array('key'=>$key));
32 32
         $color->size_id    = $specSize->id;
33 33
         $color->product_id = $specSize->product_id;
34
-        $color->color_hash = (isset($data['color_hash']) ? $data['color_hash'] : '');
35
-        $color->amount     = (isset($data['amount']) ? $data['amount'] : '');
36
-        $color->key         = (isset($data['key']) ? $data['key'] : '');
34
+        $color->color_hash = (isset($data[ 'color_hash' ]) ? $data[ 'color_hash' ] : '');
35
+        $color->amount     = (isset($data[ 'amount' ]) ? $data[ 'amount' ] : '');
36
+        $color->key = (isset($data[ 'key' ]) ? $data[ 'key' ] : '');
37 37
         $color->save();
38 38
         return $color;
39 39
     }
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
     public function delete($color)
66 66
     {
67 67
         if (is_numeric($color))
68
-            $this->find((int)$color)->delete();
68
+            $this->find((int) $color)->delete();
69 69
 
70 70
         if ($color instanceof Model)
71 71
             $color->delete();
@@ -81,7 +81,7 @@  discard block
 block discarded – undo
81 81
 
82 82
     public function getById($id) {
83 83
         return self::getModel()
84
-            ->where('size_id',$id)
84
+            ->where('size_id', $id)
85 85
             ->get();
86 86
     }
87 87
 
Please login to merge, or discard this patch.
Braces   +12 added lines, -8 removed lines patch added patch discarded remove patch
@@ -40,10 +40,11 @@  discard block
 block discarded – undo
40 40
 
41 41
     public function find($slug)
42 42
     {
43
-        if (is_numeric($slug))
44
-            return $this->getModel()
43
+        if (is_numeric($slug)) {
44
+                    return $this->getModel()
45 45
                 ->whereId((int) $slug)
46 46
                 ->first();
47
+        }
47 48
 
48 49
         return $this->getModel()
49 50
             ->whereSlug($slug)
@@ -64,11 +65,13 @@  discard block
 block discarded – undo
64 65
      */
65 66
     public function delete($color)
66 67
     {
67
-        if (is_numeric($color))
68
-            $this->find((int)$color)->delete();
68
+        if (is_numeric($color)) {
69
+                    $this->find((int)$color)->delete();
70
+        }
69 71
 
70
-        if ($color instanceof Model)
71
-            $color->delete();
72
+        if ($color instanceof Model) {
73
+                    $color->delete();
74
+        }
72 75
     }
73 76
 
74 77
     public function getByProductAndColor($product, $color)
@@ -94,8 +97,9 @@  discard block
 block discarded – undo
94 97
      */
95 98
     public function hasColor($product, $color)
96 99
     {
97
-        if ($this->getByProductAndColor($product, $color))
98
-            return true;
100
+        if ($this->getByProductAndColor($product, $color)) {
101
+                    return true;
102
+        }
99 103
 
100 104
         return false;
101 105
     }
Please login to merge, or discard this patch.
app/Repositories/ProductsRepository.php 3 patches
Doc Comments   +6 added lines, -3 removed lines patch added patch discarded remove patch
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
      *
81 81
      * @param $product
82 82
      * @param $data
83
-     * @return mixed
83
+     * @return Model
84 84
      */
85 85
     public function update($product, $data)
86 86
     {
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
      * Convert string date to \Carbon/Carbon timestamp.
128 128
      *
129 129
      * @param $date
130
-     * @return static
130
+     * @return Carbon
131 131
      */
132 132
     public function dateToTimestamp($date)
133 133
     {
@@ -361,7 +361,7 @@  discard block
 block discarded – undo
361 361
      * Create plain product for \App\Lot $lot
362 362
      *
363 363
      * @param Lot $lot
364
-     * @return static
364
+     * @return Product
365 365
      */
366 366
     public function createPlain(Lot $lot)
367 367
     {
@@ -382,6 +382,9 @@  discard block
 block discarded – undo
382 382
         return $product;
383 383
     }
384 384
 
385
+    /**
386
+     * @param Product $product
387
+     */
385 388
     public function saveProduct($product, array $data)
386 389
     {
387 390
         $product->fill([
Please login to merge, or discard this patch.
Spacing   +38 added lines, -38 removed lines patch added patch discarded remove patch
@@ -62,16 +62,16 @@  discard block
 block discarded – undo
62 62
     {
63 63
         return self::getModel()
64 64
             ->create([
65
-                'vendor_id' => $data['vendor_id'],
66
-                'name' => (isset($data['name']) ? $data['name'] : ''),
67
-                'price' => (isset($data['price']) ? $data['price'] : ''),
68
-                'sale' => (isset($data['sale'])) ? $data['sale'] : 0,
69
-                'count' => (isset($data['count'])) ? $data['count'] : 1,
70
-                'type' => (isset($data['type'])) ? $data['type'] : 'new',
71
-                'status' => (isset($data['status'])) ? $data['status'] : 'drafted',
72
-                'published_date' => (isset($data['published_date']) ? $data['published_date'] : Carbon::now()),
73
-                'expiration_date' => (isset($data['expiration_date']) ? $data['expiration_date'] : Carbon::now()),
74
-                'active' => (isset($data['active']) ? $data['active'] : 0)
65
+                'vendor_id' => $data[ 'vendor_id' ],
66
+                'name' => (isset($data[ 'name' ]) ? $data[ 'name' ] : ''),
67
+                'price' => (isset($data[ 'price' ]) ? $data[ 'price' ] : ''),
68
+                'sale' => (isset($data[ 'sale' ])) ? $data[ 'sale' ] : 0,
69
+                'count' => (isset($data[ 'count' ])) ? $data[ 'count' ] : 1,
70
+                'type' => (isset($data[ 'type' ])) ? $data[ 'type' ] : 'new',
71
+                'status' => (isset($data[ 'status' ])) ? $data[ 'status' ] : 'drafted',
72
+                'published_date' => (isset($data[ 'published_date' ]) ? $data[ 'published_date' ] : Carbon::now()),
73
+                'expiration_date' => (isset($data[ 'expiration_date' ]) ? $data[ 'expiration_date' ] : Carbon::now()),
74
+                'active' => (isset($data[ 'active' ]) ? $data[ 'active' ] : 0)
75 75
             ]);
76 76
     }
77 77
 
@@ -84,19 +84,19 @@  discard block
 block discarded – undo
84 84
      */
85 85
     public function update($product, $data)
86 86
     {
87
-        if(! $product instanceof Model)
87
+        if (!$product instanceof Model)
88 88
             throw new Exception('First argument MUST be an instance of '.Model::class);
89 89
 
90 90
         $product->fill([
91
-            'name'            => (isset($data['name']) ? $data['name'] : $product->name),
92
-            'price'           => (isset($data['price']) ? $data['price'] : $product->price),
93
-            'sale'            => (isset($data['sale'])) ? $this->formatSale($data['sale']) : $product->sale,
94
-            'count'           => (isset($data['count'])) ? $data['count'] : $product->count,
95
-            'description'     => (isset($data['description'])) ? $data['description'] : $product->description,
96
-            'type'            => (isset($data['type'])) ? $data['type'] : 'new',
91
+            'name'            => (isset($data[ 'name' ]) ? $data[ 'name' ] : $product->name),
92
+            'price'           => (isset($data[ 'price' ]) ? $data[ 'price' ] : $product->price),
93
+            'sale'            => (isset($data[ 'sale' ])) ? $this->formatSale($data[ 'sale' ]) : $product->sale,
94
+            'count'           => (isset($data[ 'count' ])) ? $data[ 'count' ] : $product->count,
95
+            'description'     => (isset($data[ 'description' ])) ? $data[ 'description' ] : $product->description,
96
+            'type'            => (isset($data[ 'type' ])) ? $data[ 'type' ] : 'new',
97 97
             'status'          => ($product->status == 'drafted') ? 'notverified' : $product->status,
98
-            'published_date'  => (isset($data['published_date']) ? $this->dateToTimestamp($data['published_date']) : $product->published_date),
99
-            'expiration_date' => (isset($data['expiration_date']) ? $this->dateToTimestamp($data['expiration_date']) : $product->published_date),
98
+            'published_date'  => (isset($data[ 'published_date' ]) ? $this->dateToTimestamp($data[ 'published_date' ]) : $product->published_date),
99
+            'expiration_date' => (isset($data[ 'expiration_date' ]) ? $this->dateToTimestamp($data[ 'expiration_date' ]) : $product->published_date),
100 100
             'active'          => 1
101 101
         ]);
102 102
 
@@ -116,9 +116,9 @@  discard block
 block discarded – undo
116 116
     {
117 117
         $datas = explode($delimiter, $date);
118 118
 
119
-        $new_date['d'] = $datas[0];
120
-        $new_date['m'] = $datas[1];
121
-        $new_date['y'] = $datas[2];
119
+        $new_date[ 'd' ] = $datas[ 0 ];
120
+        $new_date[ 'm' ] = $datas[ 1 ];
121
+        $new_date[ 'y' ] = $datas[ 2 ];
122 122
 
123 123
         return $new_date;
124 124
     }
@@ -133,7 +133,7 @@  discard block
 block discarded – undo
133 133
     {
134 134
         $dates = $this->reformatDateString($date);
135 135
 
136
-        return Carbon::createFromDate($dates['y'], $dates['m'], $dates['d']);
136
+        return Carbon::createFromDate($dates[ 'y' ], $dates[ 'm' ], $dates[ 'd' ]);
137 137
     }
138 138
 
139 139
     /**
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
         }
175 175
 
176 176
         if ($random_element_3 == 1) {
177
-            $query->whereBetween('sale', [1, 50]);
177
+            $query->whereBetween('sale', [ 1, 50 ]);
178 178
         } else {
179
-            $query->whereBetween('sale', [51, 100]);
179
+            $query->whereBetween('sale', [ 51, 100 ]);
180 180
         }
181 181
 
182 182
         return $query->get();
@@ -207,22 +207,22 @@  discard block
 block discarded – undo
207 207
     public function countInLotProduct($id)
208 208
     {
209 209
         return self::getModel()
210
-            ->where('lot_id',$id)
210
+            ->where('lot_id', $id)
211 211
             ->count();
212 212
     }
213 213
 
214 214
     public function search($filters)
215 215
     {
216 216
 
217
-        $product = $filters['search'];
217
+        $product = $filters[ 'search' ];
218 218
 
219
-        if(isset($filters['category']))
220
-            $category = $filters['category'];
219
+        if (isset($filters[ 'category' ]))
220
+            $category = $filters[ 'category' ];
221 221
 
222
-        if(empty($product) && (!isset($category)))
222
+        if (empty($product) && (!isset($category)))
223 223
             return null;
224 224
 
225
-        if(isset($category))
225
+        if (isset($category))
226 226
         {
227 227
             $query = $this->getModel()
228 228
                 ->select('products.*', 'categoryable.category_id')
@@ -260,11 +260,11 @@  discard block
 block discarded – undo
260 260
      *
261 261
      * @param mixed
262 262
      */
263
-    public function getSameProduct($id,$limit=10)
263
+    public function getSameProduct($id, $limit = 10)
264 264
     {
265 265
         $query = $this->getModel()
266 266
             ->select('products.*')
267
-            ->where('sub_category_id',$id)
267
+            ->where('sub_category_id', $id)
268 268
             ->where('products.active', 1)
269 269
             /*->where('lots.expire_date', '>', Carbon::now())*/
270 270
             ->limit($limit);
@@ -340,13 +340,13 @@  discard block
 block discarded – undo
340 340
             ->where('lots.expire_date', '>', Carbon::now())
341 341
             ->orderBy('lots.expire_date', self::ASC);
342 342
 
343
-        if(request()->get('name'))
343
+        if (request()->get('name'))
344 344
             $query->orderBy('products.name', request()->get('name') == self::ASC ? self::ASC : self::DESC);
345 345
 
346
-        if(request()->get('created_at'))
346
+        if (request()->get('created_at'))
347 347
             $query->orderBy('products.created_at', request()->get('created_at') == self::ASC ? self::ASC : self::DESC);
348 348
 
349
-        if(request()->get('price'))
349
+        if (request()->get('price'))
350 350
             $query->orderBy('products.price', request()->get('price') == self::ASC ? self::ASC : self::DESC);
351 351
 
352 352
         $query->join('lots', 'lots.id', '=', 'products.lot_id')
@@ -368,7 +368,7 @@  discard block
 block discarded – undo
368 368
         $product = self::getModel()
369 369
             ->create([
370 370
                 'lot_id' => $lot->id,
371
-                'uniqid' => substr(str_replace('.','',uniqid('00'.rand(),true)),0,10)
371
+                'uniqid' => substr(str_replace('.', '', uniqid('00'.rand(), true)), 0, 10)
372 372
 
373 373
             ]);
374 374
         /*$spec_price =  SpecPrice::create([
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
             'old_price'       => isset($data['old_price']) ? $data['old_price'] : null,
390 390
             'price'           => isset($data['price']) ? $data['price'] : null,
391 391
             'sale'            => isset($data['sale']) ? $data['sale'] : null,*/
392
-            'sub_category_id' => isset($data['sub_category']) ? $data['sub_category'] : null
392
+            'sub_category_id' => isset($data[ 'sub_category' ]) ? $data[ 'sub_category' ] : null
393 393
         ]);
394 394
 
395 395
         $product->save();
Please login to merge, or discard this patch.
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -40,11 +40,12 @@  discard block
 block discarded – undo
40 40
      */
41 41
     public function find($slug)
42 42
     {
43
-        if (is_numeric($slug))
44
-            return $this->getModel()
43
+        if (is_numeric($slug)) {
44
+                    return $this->getModel()
45 45
                 ->whereId((int) $slug)
46 46
 //                ->whereIn('status', ['published', 'drafted', 'notverified', 'completed'])
47 47
                 ->first();
48
+        }
48 49
 
49 50
         return $this->getModel()
50 51
             ->whereSlug($slug)
@@ -84,8 +85,9 @@  discard block
 block discarded – undo
84 85
      */
85 86
     public function update($product, $data)
86 87
     {
87
-        if(! $product instanceof Model)
88
-            throw new Exception('First argument MUST be an instance of '.Model::class);
88
+        if(! $product instanceof Model) {
89
+                    throw new Exception('First argument MUST be an instance of '.Model::class);
90
+        }
89 91
 
90 92
         $product->fill([
91 93
             'name'            => (isset($data['name']) ? $data['name'] : $product->name),
@@ -216,11 +218,13 @@  discard block
 block discarded – undo
216 218
 
217 219
         $product = $filters['search'];
218 220
 
219
-        if(isset($filters['category']))
220
-            $category = $filters['category'];
221
+        if(isset($filters['category'])) {
222
+                    $category = $filters['category'];
223
+        }
221 224
 
222
-        if(empty($product) && (!isset($category)))
223
-            return null;
225
+        if(empty($product) && (!isset($category))) {
226
+                    return null;
227
+        }
224 228
 
225 229
         if(isset($category))
226 230
         {
@@ -340,14 +344,17 @@  discard block
 block discarded – undo
340 344
             ->where('lots.expire_date', '>', Carbon::now())
341 345
             ->orderBy('lots.expire_date', self::ASC);
342 346
 
343
-        if(request()->get('name'))
344
-            $query->orderBy('products.name', request()->get('name') == self::ASC ? self::ASC : self::DESC);
347
+        if(request()->get('name')) {
348
+                    $query->orderBy('products.name', request()->get('name') == self::ASC ? self::ASC : self::DESC);
349
+        }
345 350
 
346
-        if(request()->get('created_at'))
347
-            $query->orderBy('products.created_at', request()->get('created_at') == self::ASC ? self::ASC : self::DESC);
351
+        if(request()->get('created_at')) {
352
+                    $query->orderBy('products.created_at', request()->get('created_at') == self::ASC ? self::ASC : self::DESC);
353
+        }
348 354
 
349
-        if(request()->get('price'))
350
-            $query->orderBy('products.price', request()->get('price') == self::ASC ? self::ASC : self::DESC);
355
+        if(request()->get('price')) {
356
+                    $query->orderBy('products.price', request()->get('price') == self::ASC ? self::ASC : self::DESC);
357
+        }
351 358
 
352 359
         $query->join('lots', 'lots.id', '=', 'products.lot_id')
353 360
             ->where('lots.status', Lot::STATUS_COMPLETE)
Please login to merge, or discard this patch.
app/Repositories/RecoverpasswordRepository.php 1 patch
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace App\Repositories;
4 4
 
5 5
 use App\RecoverPassword;
6
-use Auth;
7 6
 
8 7
 class RecoverPasswordRepository extends Repository
9 8
 {
Please login to merge, or discard this patch.
app/Repositories/SocialiteRepository.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -95,7 +95,7 @@
 block discarded – undo
95 95
     /**
96 96
      * Callback to json.
97 97
      *
98
-     * @param $callback
98
+     * @param ProviderUser $callback
99 99
      * @return string
100 100
      */
101 101
     private function cleanCallback($callback)
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -101,8 +101,8 @@
 block discarded – undo
101 101
     private function cleanCallback($callback)
102 102
     {
103 103
         $array_callback = (array) $callback;
104
-        $user           = $array_callback['user'];
105
-        unset($array_callback['user']);
104
+        $user           = $array_callback[ 'user' ];
105
+        unset($array_callback[ 'user' ]);
106 106
         return json_encode(array_merge($array_callback, $user));
107 107
     }
108 108
 }
109 109
\ No newline at end of file
Please login to merge, or discard this patch.
app/Repositories/SpecPriceRepository.php 3 patches
Doc Comments   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@  discard block
 block discarded – undo
16 16
 
17 17
     /**
18 18
      * @param $product_id
19
-     * @return static
19
+     * @return SpecPrice
20 20
      */
21 21
     public function createPlain($product_id)
22 22
     {
@@ -65,7 +65,7 @@  discard block
 block discarded – undo
65 65
      * 
66 66
      * @param $spec
67 67
      * @param array $data
68
-     * @return mixed
68
+     * @return SpecPrice
69 69
      */
70 70
 
71 71
     public function create(array $data, $product)
@@ -81,6 +81,9 @@  discard block
 block discarded – undo
81 81
             ]);
82 82
     }
83 83
 
84
+    /**
85
+     * @param Product $product
86
+     */
84 87
     public function save(array $data, $product)
85 88
     {
86 89
         $key = ((isset($data['key']) &&  $data['key'] != null) ? $data['key'] : null);
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace App\Repositories;
4 4
 
5 5
 use App\SpecPrice;
6
-use App\Product;
7 6
 class SpecPriceRepository extends Repository
8 7
 {
9 8
     /**
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -74,24 +74,24 @@  discard block
 block discarded – undo
74 74
             ->create([
75 75
                 'lot_id'     => $product->lot_id,
76 76
                 'product_id' => $product->id,
77
-                'new_price'  => (isset($data['new_price']) ? $data['new_price'] : ''),
78
-                'old_price'  => (isset($data['old_price']) ? $data['old_price'] : ''),
79
-                'sale'       => (isset($data['sale'])) ? $data['sale'] : 0,
80
-                'name'       => (isset($data['name'])) ? $data['name'] : null
77
+                'new_price'  => (isset($data[ 'new_price' ]) ? $data[ 'new_price' ] : ''),
78
+                'old_price'  => (isset($data[ 'old_price' ]) ? $data[ 'old_price' ] : ''),
79
+                'sale'       => (isset($data[ 'sale' ])) ? $data[ 'sale' ] : 0,
80
+                'name'       => (isset($data[ 'name' ])) ? $data[ 'name' ] : null
81 81
             ]);
82 82
     }
83 83
 
84 84
     public function save(array $data, $product)
85 85
     {
86
-        $key = ((isset($data['key']) &&  $data['key'] != null) ? $data['key'] : null);
86
+        $key = ((isset($data[ 'key' ]) && $data[ 'key' ] != null) ? $data[ 'key' ] : null);
87 87
         $price = self::getModel()->firstOrNew(array('key'=>$key));
88 88
         $price->product_id = $product->id;
89 89
         $price->lot_id     = $product->lot_id;
90
-        $price->new_price  = (isset($data['new_price']) ? $data['new_price'] : '');
91
-        $price->old_price  = (isset($data['old_price']) ? $data['old_price'] : '');
92
-        $price->sale       = (isset($data['sale'])) ? $data['sale'] : 0;
93
-        $price->name       = (isset($data['name']) ? $data['name'] : ''); 
94
-        $price->key        = (isset($data['key']) ? $data['key'] : '');
90
+        $price->new_price  = (isset($data[ 'new_price' ]) ? $data[ 'new_price' ] : '');
91
+        $price->old_price  = (isset($data[ 'old_price' ]) ? $data[ 'old_price' ] : '');
92
+        $price->sale       = (isset($data[ 'sale' ])) ? $data[ 'sale' ] : 0;
93
+        $price->name       = (isset($data[ 'name' ]) ? $data[ 'name' ] : ''); 
94
+        $price->key        = (isset($data[ 'key' ]) ? $data[ 'key' ] : '');
95 95
         $price->save();
96 96
         return $price;
97 97
     }
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
     public function update($spec, array $data)
100 100
     {
101 101
         $spec->fill([
102
-            'size'       => isset($data['size']) ? $data['size'] : null,
103
-            'color_hash' => isset($data['color']) ? $data['color'] : null,
104
-            'amount'     => isset($data['sold']) ? $data['sold'] : null
102
+            'size'       => isset($data[ 'size' ]) ? $data[ 'size' ] : null,
103
+            'color_hash' => isset($data[ 'color' ]) ? $data[ 'color' ] : null,
104
+            'amount'     => isset($data[ 'sold' ]) ? $data[ 'sold' ] : null
105 105
         ]);
106 106
         
107 107
         $spec->save();
Please login to merge, or discard this patch.
app/Repositories/SubscribeRepository.php 3 patches
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -3,7 +3,6 @@
 block discarded – undo
3 3
 namespace App\Repositories;
4 4
 
5 5
 use App\Subscribe;
6
-use Auth;
7 6
 
8 7
 class SubscribeRepository extends Repository
9 8
 {
Please login to merge, or discard this patch.
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,8 +23,8 @@  discard block
 block discarded – undo
23 23
     {
24 24
         return self::getModel()
25 25
             ->create([
26
-	        'email'  => $data['email'],
27
-	        'token'  => str_random(30),
26
+            'email'  => $data['email'],
27
+            'token'  => str_random(30),
28 28
         ]);
29 29
     }
30 30
 
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
     {
33 33
         $model = $this->getByEmail($email);
34 34
 
35
-	       return (bool) $model;
35
+            return (bool) $model;
36 36
     }
37 37
 
38 38
     /**
Please login to merge, or discard this patch.
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
     {
24 24
         return self::getModel()
25 25
             ->create([
26
-	        'email'  => $data['email'],
26
+	        'email'  => $data[ 'email' ],
27 27
 	        'token'  => str_random(30),
28 28
         ]);
29 29
     }
Please login to merge, or discard this patch.