Passed
Push — develop ( 62f833...95decf )
by Septianata
11:22
created
app/Models/Concerns/Item/Event.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@
 block discarded – undo
19 19
      */
20 20
     protected static function bootEvent()
21 21
     {
22
-        static::saving(function (Item $model) {
22
+        static::saving(function(Item $model) {
23 23
             if (is_null($model->quantity_per_bundle)) {
24 24
                 $model->quantity_per_bundle = $model->getDenominationRelationValue()->quantity_per_bundle;
25 25
             }
Please login to merge, or discard this patch.
app/Http/Requests/Order/AbstractRequest.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,12 +29,12 @@  discard block
 block discarded – undo
29 29
             'order_status.note' => trans('Note'),
30 30
         ];
31 31
 
32
-        foreach (request()->input('items', []) as $index => $item) {
32
+        foreach (request()->input('items', [ ]) as $index => $item) {
33 33
             $number = $index + 1;
34 34
 
35
-            $attributes['items.' . $index . '.denomination_id'] = trans('admin-lang.denomination') . ' ' . $number;
36
-            $attributes['items.' . $index . '.quantity_per_bundle'] = trans('Quantity Per Bundle') . ' ' . $number;
37
-            $attributes['items.' . $index . '.bundle_quantity'] = trans('Bundle Quantity') . ' ' . $number;
35
+            $attributes[ 'items.'.$index.'.denomination_id' ] = trans('admin-lang.denomination').' '.$number;
36
+            $attributes[ 'items.'.$index.'.quantity_per_bundle' ] = trans('Quantity Per Bundle').' '.$number;
37
+            $attributes[ 'items.'.$index.'.bundle_quantity' ] = trans('Bundle Quantity').' '.$number;
38 38
         }
39 39
 
40 40
         return $attributes;
@@ -70,9 +70,9 @@  discard block
 block discarded – undo
70 70
      */
71 71
     public function getItems(): Collection
72 72
     {
73
-        return Collection::make(data_get($this->validated(), 'items.*', []))->map(
74
-            fn (array $item) => Item::make($item)->setDenominationRelationValue(
75
-                Denomination::find($item['denomination_id'])
73
+        return Collection::make(data_get($this->validated(), 'items.*', [ ]))->map(
74
+            fn(array $item) => Item::make($item)->setDenominationRelationValue(
75
+                Denomination::find($item[ 'denomination_id' ])
76 76
             )
77 77
         );
78 78
     }
Please login to merge, or discard this patch.
app/Http/Requests/Order/StoreRequest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -16,21 +16,21 @@
 block discarded – undo
16 16
     public static function getRules()
17 17
     {
18 18
         $rules = [
19
-            'customer_id' => 'required|exists:' . Customer::class . ',id',
20
-            'user_id' => 'sometimes|nullable|exists:' . User::class . ',id',
21
-            'branch_id' => 'sometimes|nullable|exists:' . Branch::class . ',id',
19
+            'customer_id' => 'required|exists:'.Customer::class.',id',
20
+            'user_id' => 'sometimes|nullable|exists:'.User::class.',id',
21
+            'branch_id' => 'sometimes|nullable|exists:'.Branch::class.',id',
22 22
             'schedule_date' => 'sometimes|nullable|date|after_or_equal:today',
23
-            'order_status.status' => 'required|enum:' . OrderStatus::class,
23
+            'order_status.status' => 'required|enum:'.OrderStatus::class,
24 24
             'order_status.note' => 'sometimes|nullable|string|max:255',
25 25
             'items' => 'required|array',
26
-            'items.*.denomination_id' => 'required|distinct|exists:' . Denomination::class . ',id',
26
+            'items.*.denomination_id' => 'required|distinct|exists:'.Denomination::class.',id',
27 27
         ];
28 28
 
29
-        foreach (request()->input('items', []) as $index => $item) {
29
+        foreach (request()->input('items', [ ]) as $index => $item) {
30 30
             /** @var \App\Models\Denomination $denomination */
31
-            $denomination = Denomination::findOrFail($item['denomination_id'] ?? null);
31
+            $denomination = Denomination::findOrFail($item[ 'denomination_id' ] ?? null);
32 32
 
33
-            $rules['items.' . $index . '.bundle_quantity'] = 'required|numeric|between:' . $denomination->minimum_order_bundle . ',' . $denomination->maximum_order_bundle;
33
+            $rules[ 'items.'.$index.'.bundle_quantity' ] = 'required|numeric|between:'.$denomination->minimum_order_bundle.','.$denomination->maximum_order_bundle;
34 34
         }
35 35
 
36 36
         return $rules;
Please login to merge, or discard this patch.
app/Http/Requests/Order/UpdateRequest.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -19,21 +19,21 @@
 block discarded – undo
19 19
     public static function getRules()
20 20
     {
21 21
         $rules = [
22
-            'customer_id' => 'required|exists:' . Customer::class . ',id',
23
-            'user_id' => 'sometimes|nullable|exists:' . User::class . ',id',
24
-            'branch_id' => 'sometimes|nullable|exists:' . Branch::class . ',id',
22
+            'customer_id' => 'required|exists:'.Customer::class.',id',
23
+            'user_id' => 'sometimes|nullable|exists:'.User::class.',id',
24
+            'branch_id' => 'sometimes|nullable|exists:'.Branch::class.',id',
25 25
             'schedule_date' => 'sometimes|nullable|date|after_or_equal:today',
26
-            'order_status.status' => 'sometimes|nullable|enum:' . OrderStatus::class,
26
+            'order_status.status' => 'sometimes|nullable|enum:'.OrderStatus::class,
27 27
             'order_status.note' => 'sometimes|nullable|string|max:255',
28 28
             'items' => 'sometimes|nullable|array',
29 29
         ];
30 30
 
31
-        foreach (request()->input('items', []) as $index => $item) {
31
+        foreach (request()->input('items', [ ]) as $index => $item) {
32 32
             /** @var \App\Models\Denomination $denomination */
33
-            $denomination = Denomination::findOrFail($item['denomination_id'] ?? null);
33
+            $denomination = Denomination::findOrFail($item[ 'denomination_id' ] ?? null);
34 34
 
35
-            $rules['items.' . $index . '.denomination_id'] = 'required|distinct|exists:' . Denomination::class . ',id';
36
-            $rules['items.' . $index . '.bundle_quantity'] = 'required|numeric|between:' . $denomination->minimum_order_bundle . ',' . $denomination->maximum_order_bundle;
35
+            $rules[ 'items.'.$index.'.denomination_id' ] = 'required|distinct|exists:'.Denomination::class.',id';
36
+            $rules[ 'items.'.$index.'.bundle_quantity' ] = 'required|numeric|between:'.$denomination->minimum_order_bundle.','.$denomination->maximum_order_bundle;
37 37
         }
38 38
 
39 39
         return $rules;
Please login to merge, or discard this patch.
app/Http/Requests/Customer/StoreRequest.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -14,8 +14,8 @@  discard block
 block discarded – undo
14 14
      */
15 15
     public static function getRules()
16 16
     {
17
-        $phoneRule = function () {
18
-            return ['required', 'string', 'phone:ID', function ($attribute, $phone, $fail) {
17
+        $phoneRule = function() {
18
+            return [ 'required', 'string', 'phone:ID', function($attribute, $phone, $fail) {
19 19
                 $country = $attribute === 'phone'
20 20
                     ? request()->input('phone_country', env('PHONE_COUNTRY', 'ID'))
21 21
                     : request()->input('whatsapp_phone_country', env('PHONE_COUNTRY', 'ID'));
@@ -24,23 +24,23 @@  discard block
 block discarded – undo
24 24
                     ->count();
25 25
 
26 26
                 if ($user > 0) {
27
-                    $fail(trans('validation.unique', ['attribute' => static::getAttributes()[$attribute]]));
27
+                    $fail(trans('validation.unique', [ 'attribute' => static::getAttributes()[ $attribute ] ]));
28 28
                 }
29
-            }];
29
+            } ];
30 30
         };
31 31
 
32 32
         return [
33
-            'telegram_chat_id' => 'required|string|max:255|unique:' . Customer::class,
33
+            'telegram_chat_id' => 'required|string|max:255|unique:'.Customer::class,
34 34
             'username' => 'required|string|max:255',
35 35
             'fullname' => 'required|string|max:255',
36
-            'gender' => 'sometimes|nullable|enum:' . Gender::class,
37
-            'email' => 'required|string|email|max:255|unique:' . Customer::class,
36
+            'gender' => 'sometimes|nullable|enum:'.Gender::class,
37
+            'email' => 'required|string|email|max:255|unique:'.Customer::class,
38 38
             'phone_country' => 'sometimes|in:ID',
39 39
             'phone' => value($phoneRule),
40 40
             'whatsapp_phone_country' => 'sometimes|in:ID',
41 41
             'whatsapp_phone' => value($phoneRule),
42
-            'account_number' => ['required_without:identitycard_number'] + (request()->filled('account_number') ? ['numeric'] : []),
43
-            'identitycard_number' => ['required_without:account_number'] + (request()->filled('identitycard_number') ? ['numeric'] : []),
42
+            'account_number' => [ 'required_without:identitycard_number' ] + (request()->filled('account_number') ? [ 'numeric' ] : [ ]),
43
+            'identitycard_number' => [ 'required_without:account_number' ] + (request()->filled('identitycard_number') ? [ 'numeric' ] : [ ]),
44 44
             'identitycard_image' => 'sometimes|nullable|image',
45 45
             'location_latitude' => 'required|numeric',
46 46
             'location_longitude' => 'required|numeric',
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 
64 64
         $file->storeAs(
65 65
             Customer::IDENTITYCARD_IMAGE_PATH,
66
-            $filename = (Str::random() . '.' . $file->getClientOriginalExtension())
66
+            $filename = (Str::random().'.'.$file->getClientOriginalExtension())
67 67
         );
68 68
 
69 69
         return $filename;
Please login to merge, or discard this patch.
app/Http/Requests/Customer/UpdateRequest.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
      */
17 17
     public static function getRules()
18 18
     {
19
-        $phoneRule = function () {
20
-            return ['required', 'string', 'phone:ID', function ($attribute, $phone, $fail) {
19
+        $phoneRule = function() {
20
+            return [ 'required', 'string', 'phone:ID', function($attribute, $phone, $fail) {
21 21
                 $country = $attribute === 'phone'
22 22
                     ? request()->input('phone_country', env('PHONE_COUNTRY', 'ID'))
23 23
                     : request()->input('whatsapp_phone_country', env('PHONE_COUNTRY', 'ID'));
@@ -27,13 +27,13 @@  discard block
 block discarded – undo
27 27
                     ->count();
28 28
 
29 29
                 if ($user > 0) {
30
-                    $fail(trans('validation.unique', ['attribute' => static::getAttributes()[$attribute]]));
30
+                    $fail(trans('validation.unique', [ 'attribute' => static::getAttributes()[ $attribute ] ]));
31 31
                 }
32
-            }];
32
+            } ];
33 33
         };
34 34
 
35 35
         return [
36
-            'telegram_chat_id' => ['required', 'string', 'max:255', function ($attribute, $telegram_chat_id, $fail) {
36
+            'telegram_chat_id' => [ 'required', 'string', 'max:255', function($attribute, $telegram_chat_id, $fail) {
37 37
                 $validator = Validator::make(compact('telegram_chat_id'), [
38 38
                     $attribute => Rule::unique(Customer::class)->ignore($telegram_chat_id, $attribute),
39 39
                 ]);
@@ -41,11 +41,11 @@  discard block
 block discarded – undo
41 41
                 if ($validator->fails()) {
42 42
                     $fail(trans('validation.unique', compact('attribute')));
43 43
                 }
44
-            }],
44
+            } ],
45 45
             'username' => 'required|string|max:255',
46 46
             'fullname' => 'required|string|max:255',
47
-            'gender' => 'sometimes|nullable|enum:' . Gender::class,
48
-            'email' => ['required', 'string', 'email', 'max:255', function ($attribute, $email, $fail) {
47
+            'gender' => 'sometimes|nullable|enum:'.Gender::class,
48
+            'email' => [ 'required', 'string', 'email', 'max:255', function($attribute, $email, $fail) {
49 49
                 $validator = Validator::make(compact('email'), [
50 50
                     $attribute => Rule::unique(Customer::class)->ignore($email, $attribute),
51 51
                 ]);
@@ -53,13 +53,13 @@  discard block
 block discarded – undo
53 53
                 if ($validator->fails()) {
54 54
                     $fail(trans('validation.unique', compact('attribute')));
55 55
                 }
56
-            }],
56
+            } ],
57 57
             'phone_country' => 'sometimes|in:ID',
58 58
             'phone' => value($phoneRule),
59 59
             'whatsapp_phone_country' => 'sometimes|in:ID',
60 60
             'whatsapp_phone' => value($phoneRule),
61
-            'account_number' => ['required_without:identitycard_number'] + (request()->filled('account_number') ? ['numeric'] : []),
62
-            'identitycard_number' => ['required_without:account_number'] + (request()->filled('identitycard_number') ? ['numeric'] : []),
61
+            'account_number' => [ 'required_without:identitycard_number' ] + (request()->filled('account_number') ? [ 'numeric' ] : [ ]),
62
+            'identitycard_number' => [ 'required_without:account_number' ] + (request()->filled('identitycard_number') ? [ 'numeric' ] : [ ]),
63 63
             'identitycard_image' => 'sometimes|nullable|image',
64 64
             'location_latitude' => 'required|numeric',
65 65
             'location_longitude' => 'required|numeric',
@@ -82,14 +82,14 @@  discard block
 block discarded – undo
82 82
         $model = $this->route('customer');
83 83
 
84 84
         if ($model->getRawOriginal('identitycard_image') && $this->hasFile($key)) {
85
-            Storage::delete(Customer::IDENTITYCARD_IMAGE_PATH . '/' . $model->getRawOriginal('identitycard_image'));
85
+            Storage::delete(Customer::IDENTITYCARD_IMAGE_PATH.'/'.$model->getRawOriginal('identitycard_image'));
86 86
         }
87 87
 
88 88
         $file = $this->file($key);
89 89
 
90 90
         $file->storeAs(
91 91
             Customer::IDENTITYCARD_IMAGE_PATH,
92
-            $filename = ($this->input('value') . '.' . $file->getClientOriginalExtension())
92
+            $filename = ($this->input('value').'.'.$file->getClientOriginalExtension())
93 93
         );
94 94
 
95 95
         return $filename;
Please login to merge, or discard this patch.
app/Http/Requests/Role/StoreRequest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
     public function rules()
14 14
     {
15 15
         return [
16
-            'name' => 'required|string|max:255|unique:' . Role::class,
17
-            'guard_name' => ['required', 'string', Rule::in(array_keys(config('auth.guards')))],
16
+            'name' => 'required|string|max:255|unique:'.Role::class,
17
+            'guard_name' => [ 'required', 'string', Rule::in(array_keys(config('auth.guards'))) ],
18 18
         ];
19 19
     }
20 20
 }
Please login to merge, or discard this patch.
app/Http/Requests/Role/UpdateRequest.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,8 +13,8 @@
 block discarded – undo
13 13
     public function rules()
14 14
     {
15 15
         return [
16
-            'name' => ['required', 'string', 'max:255', Rule::unique(Role::class)->ignoreModel($this->route('role'))],
17
-            'guard_name' => ['required', 'string', Rule::in(array_keys(config('auth.guards')))],
16
+            'name' => [ 'required', 'string', 'max:255', Rule::unique(Role::class)->ignoreModel($this->route('role')) ],
17
+            'guard_name' => [ 'required', 'string', Rule::in(array_keys(config('auth.guards'))) ],
18 18
         ];
19 19
     }
20 20
 }
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/OrderController.php 1 patch
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -33,25 +33,25 @@  discard block
 block discarded – undo
33 33
     public function datatable()
34 34
     {
35 35
         return DataTables::eloquent(Order::query()->with('user:id,fullname'))
36
-            ->setTransformer(fn ($model) => OrderResource::make($model)->resolve())
37
-            ->orderColumn('customer_fullname', function ($query, $direction) {
36
+            ->setTransformer(fn($model) => OrderResource::make($model)->resolve())
37
+            ->orderColumn('customer_fullname', function($query, $direction) {
38 38
                 $query->join('customers', 'orders.customer_id', '=', 'customers.id')
39 39
                     ->select('orders.*', 'customers.id as customer_id', 'customers.fullname as customer_fullname')
40 40
                     ->orderBy('customers.fullname', $direction);
41 41
             })
42
-            ->filterColumn('customer_fullname', function ($query, $keyword) {
43
-                $query->whereHas('customer', function ($query) use ($keyword) {
44
-                    $query->where('fullname', 'like', '%' . $keyword . '%');
42
+            ->filterColumn('customer_fullname', function($query, $keyword) {
43
+                $query->whereHas('customer', function($query) use ($keyword) {
44
+                    $query->where('fullname', 'like', '%'.$keyword.'%');
45 45
                 });
46 46
             })
47
-            ->orderColumn('status', function ($query, $direction) {
47
+            ->orderColumn('status', function($query, $direction) {
48 48
                 $query->join('order_statuses', 'order_statuses.order_id', '=', 'orders.id')
49 49
                     ->select('orders.*', 'order_statuses.id as order_status_id', 'order_statuses.status as order_status')
50 50
                     ->orderBy('order_statuses.status', $direction);
51 51
             })
52
-            ->filterColumn('status', function ($query, $keyword) {
53
-                $query->whereHas('latestStatus', function ($query) use ($keyword) {
54
-                    $query->where('status', 'like', '%' . $keyword . '%');
52
+            ->filterColumn('status', function($query, $keyword) {
53
+                $query->whereHas('latestStatus', function($query) use ($keyword) {
54
+                    $query->where('status', 'like', '%'.$keyword.'%');
55 55
                 });
56 56
             })
57 57
             ->toJson();
@@ -89,17 +89,17 @@  discard block
 block discarded – undo
89 89
         $alert = [
90 90
             'alert' => [
91 91
                 'type' => 'alert-success',
92
-                'message' => trans('The :resource was created!', ['resource' => trans('admin-lang.user')]),
92
+                'message' => trans('The :resource was created!', [ 'resource' => trans('admin-lang.user') ]),
93 93
             ],
94 94
         ];
95 95
 
96 96
         try {
97
-            DB::transaction(function () use ($request) {
97
+            DB::transaction(function() use ($request) {
98 98
                 $order = $request->getOrder();
99 99
 
100 100
                 $order->setCustomerRelationValue($request->getCustomer());
101
-                transform($request->getUser(), fn (User $user) => $order->setUserRelationValue($user));
102
-                transform($request->getBranch(), fn (Branch $branch) => $order->setBranchRelationValue($branch));
101
+                transform($request->getUser(), fn(User $user) => $order->setUserRelationValue($user));
102
+                transform($request->getBranch(), fn(Branch $branch) => $order->setBranchRelationValue($branch));
103 103
 
104 104
                 $order->save();
105 105
 
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
         return redirect()->route('admin.order.index')->with([
146 146
             'alert' => [
147 147
                 'type' => 'alert-success',
148
-                'message' => trans('The :resource was updated!', ['resource' => trans('admin-lang.order')]),
148
+                'message' => trans('The :resource was updated!', [ 'resource' => trans('admin-lang.order') ]),
149 149
             ],
150 150
         ]);
151 151
     }
@@ -163,7 +163,7 @@  discard block
 block discarded – undo
163 163
         return redirect()->route('admin.order.index')->with([
164 164
             'alert' => [
165 165
                 'type' => 'alert-success',
166
-                'message' => trans('The :resource was deleted!', ['resource' => trans('admin-lang.order')]),
166
+                'message' => trans('The :resource was deleted!', [ 'resource' => trans('admin-lang.order') ]),
167 167
             ],
168 168
         ]);
169 169
     }
@@ -176,12 +176,12 @@  discard block
 block discarded – undo
176 176
      */
177 177
     public function destroyMultiple(Request $request)
178 178
     {
179
-        Order::destroy($request->input('checkbox', []));
179
+        Order::destroy($request->input('checkbox', [ ]));
180 180
 
181 181
         return redirect()->route('admin.order.index')->with([
182 182
             'alert' => [
183 183
                 'type' => 'alert-success',
184
-                'message' => trans('The :resource was deleted!', ['resource' => trans('admin-lang.order')]),
184
+                'message' => trans('The :resource was deleted!', [ 'resource' => trans('admin-lang.order') ]),
185 185
             ],
186 186
         ]);
187 187
     }
Please login to merge, or discard this patch.