Passed
Push — develop ( b4818b...dcecff )
by Septianata
16:14
created
app/Conversations/RegisterCustomerConversation.php 1 patch
Spacing   +33 added lines, -33 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
     {
35 35
         $this->displayValidationErrorMessage($validationErrorMessage);
36 36
 
37
-        return $this->askRenderable('conversations.exchange.ask-email', function (Answer $answer) {
37
+        return $this->askRenderable('conversations.exchange.ask-email', function(Answer $answer) {
38 38
             $value = $answer->getText();
39 39
             $validator = CustomerStoreRequest::createValidator($value, 'email');
40 40
 
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
                 return $this->askEmail($validator->errors()->first('email'));
43 43
             }
44 44
 
45
-            $this->setUserStorage(['email' => $email = $validator->validated()['email']]);
45
+            $this->setUserStorage([ 'email' => $email = $validator->validated()[ 'email' ] ]);
46 46
 
47 47
             $username = $this->getUser()->getUsername();
48 48
 
@@ -64,7 +64,7 @@  discard block
 block discarded – undo
64 64
     {
65 65
         $this->displayValidationErrorMessage($validationErrorMessage);
66 66
 
67
-        return $this->askRenderable('conversations.register-customer.ask-fullname', function (Answer $answer) {
67
+        return $this->askRenderable('conversations.register-customer.ask-fullname', function(Answer $answer) {
68 68
             $value = $answer->getText();
69 69
             $validator = CustomerStoreRequest::createValidator($value, 'fullname');
70 70
 
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
                 return $this->askFullName($validator->errors()->first('fullname'));
73 73
             }
74 74
 
75
-            $this->setUserStorage(['fullname' => $validator->validated()['fullname']]);
75
+            $this->setUserStorage([ 'fullname' => $validator->validated()[ 'fullname' ] ]);
76 76
 
77 77
             return $this->askIdentityNumberOption();
78 78
         });
@@ -101,12 +101,12 @@  discard block
 block discarded – undo
101 101
                 Button::create(view('conversations.register-customer.reply-identity_number-no')->render())->value('no'),
102 102
             ]);
103 103
 
104
-        return $this->ask($question, function (Answer $answer) {
104
+        return $this->ask($question, function(Answer $answer) {
105 105
             if (!$answer->isInteractiveMessageReply()) {
106 106
                 return;
107 107
             }
108 108
 
109
-            if (!in_array($value = $answer->getValue(), ['yes', 'no'])) {
109
+            if (!in_array($value = $answer->getValue(), [ 'yes', 'no' ])) {
110 110
                 return $this->askIdentityNumberOption($this->fallbackMessage($answer->getText()));
111 111
             }
112 112
 
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
      */
124 124
     protected function backToIdentityNumberOption(): string
125 125
     {
126
-        return trim(view('components.conversations.back', ['text' => 'opsi rekening/KTP'])->render());
126
+        return trim(view('components.conversations.back', [ 'text' => 'opsi rekening/KTP' ])->render());
127 127
     }
128 128
 
129 129
     /**
@@ -153,7 +153,7 @@  discard block
 block discarded – undo
153 153
             $additionalParameters = $this->keyboardBackToIdentityNumberOption()->toArray()
154 154
         );
155 155
 
156
-        return $this->getBot()->storeConversation($this, next: function (Answer $answer) use ($response) {
156
+        return $this->getBot()->storeConversation($this, next: function(Answer $answer) use ($response) {
157 157
             if (trim($answer->getText()) === $this->backToIdentityNumberOption()) {
158 158
                 $this->deleteTelegramMessageFromResponse($response);
159 159
 
@@ -167,7 +167,7 @@  discard block
 block discarded – undo
167 167
                 return $this->askAccountNumber($validator->errors()->first('account_number'));
168 168
             }
169 169
 
170
-            $this->setUserStorage(['account_number' => $validator->validated()['account_number']]);
170
+            $this->setUserStorage([ 'account_number' => $validator->validated()[ 'account_number' ] ]);
171 171
 
172 172
             return $this->askPhone();
173 173
         }, question: $question, additionalParameters: $additionalParameters);
@@ -188,7 +188,7 @@  discard block
 block discarded – undo
188 188
             $additionalParameters = $this->keyboardBackToIdentityNumberOption()->toArray()
189 189
         );
190 190
 
191
-        return $this->getBot()->storeConversation($this, next: function (Answer $answer) use ($response) {
191
+        return $this->getBot()->storeConversation($this, next: function(Answer $answer) use ($response) {
192 192
             if (trim($answer->getText()) === $this->backToIdentityNumberOption()) {
193 193
                 $this->deleteTelegramMessageFromResponse($response);
194 194
 
@@ -202,7 +202,7 @@  discard block
 block discarded – undo
202 202
                 return $this->askIdentityCard($validator->errors()->first('identitycard_number'));
203 203
             }
204 204
 
205
-            $this->setUserStorage(['identitycard_number' => $validator->validated()['identitycard_number']]);
205
+            $this->setUserStorage([ 'identitycard_number' => $validator->validated()[ 'identitycard_number' ] ]);
206 206
 
207 207
             return $this->askPhone();
208 208
         }, question: $question, additionalParameters: $additionalParameters);
@@ -218,7 +218,7 @@  discard block
 block discarded – undo
218 218
     {
219 219
         $this->displayValidationErrorMessage($validationErrorMessage);
220 220
 
221
-        return $this->askRenderable('conversations.register-customer.ask-phone', function () {
221
+        return $this->askRenderable('conversations.register-customer.ask-phone', function() {
222 222
             $value = $this->getMessagePayload('contact.phone_number');
223 223
             $validator = CustomerStoreRequest::createValidator($value, 'phone');
224 224
 
@@ -226,15 +226,15 @@  discard block
 block discarded – undo
226 226
                 return $this->askPhone($validator->errors()->first('phone'));
227 227
             }
228 228
 
229
-            $this->setUserStorage(['phone' => $validator->validated()['phone']]);
229
+            $this->setUserStorage([ 'phone' => $validator->validated()[ 'phone' ] ]);
230 230
 
231 231
             return $this->askWhatsappPhone();
232
-        }, additionalParameters: ['reply_markup' => json_encode([
233
-            'keyboard' => [[['text' => '☎️ ' . trans('Send My Phone Number'), 'request_contact' => true]]],
232
+        }, additionalParameters: [ 'reply_markup' => json_encode([
233
+            'keyboard' => [ [ [ 'text' => '☎️ '.trans('Send My Phone Number'), 'request_contact' => true ] ] ],
234 234
             'resize_keyboard' => true,
235 235
             'one_time_keyboard' => true,
236 236
             'remove_keyboard' => true,
237
-        ])]);
237
+        ]) ]);
238 238
     }
239 239
 
240 240
     /**
@@ -247,34 +247,34 @@  discard block
 block discarded – undo
247 247
     {
248 248
         $this->displayValidationErrorMessage($validationErrorMessage);
249 249
 
250
-        $question = Question::create(view('conversations.register-customer.confirm-whatsapp_phone', ['phone' => $this->getUserStorage('phone')])->render())
250
+        $question = Question::create(view('conversations.register-customer.confirm-whatsapp_phone', [ 'phone' => $this->getUserStorage('phone') ])->render())
251 251
             ->callbackId('register_confirm_whatsapp_phone')
252 252
             ->addButtons([
253 253
                 Button::create(view('conversations.register-customer.reply-whatsapp_phone-yes')->render())->value('yes'),
254 254
                 Button::create(view('conversations.register-customer.reply-whatsapp_phone-no')->render())->value('no'),
255 255
             ]);
256 256
 
257
-        return $this->ask($question, function (Answer $answer) {
257
+        return $this->ask($question, function(Answer $answer) {
258 258
             if (!$answer->isInteractiveMessageReply()) {
259 259
                 return;
260 260
             }
261 261
 
262
-            if (!in_array($value = $answer->getValue(), ['yes', 'no'])) {
262
+            if (!in_array($value = $answer->getValue(), [ 'yes', 'no' ])) {
263 263
                 return $this->askWhatsappPhone($this->fallbackMessage($answer->getText()));
264 264
             }
265 265
 
266 266
             $phone = $this->getUserStorage('phone');
267 267
 
268 268
             if ($value === 'yes') {
269
-                $this->setUserStorage(['whatsapp_phone' => $phone]);
269
+                $this->setUserStorage([ 'whatsapp_phone' => $phone ]);
270 270
 
271 271
                 return $this->askLocation();
272 272
             }
273 273
 
274
-            return value(function (string $validationErrorMessage = null) use (&$callback) {
274
+            return value(function(string $validationErrorMessage = null) use (&$callback) {
275 275
                 $this->displayValidationErrorMessage($validationErrorMessage);
276 276
 
277
-                $this->askRenderable('conversations.register-customer.ask-whatsapp_phone', function (Answer $answer) use (&$phone, $callback) {
277
+                $this->askRenderable('conversations.register-customer.ask-whatsapp_phone', function(Answer $answer) use (&$phone, $callback) {
278 278
                     $value = $answer->getText();
279 279
                     $validator = CustomerStoreRequest::createValidator($value, 'whatsapp_phone');
280 280
 
@@ -282,9 +282,9 @@  discard block
 block discarded – undo
282 282
                         return $callback($validator->errors()->first('whatsapp_phone'));
283 283
                     }
284 284
 
285
-                    $phone = $validator->validated()['whatsapp_phone'];
285
+                    $phone = $validator->validated()[ 'whatsapp_phone' ];
286 286
 
287
-                    $this->setUserStorage(['whatsapp_phone' => $phone]);
287
+                    $this->setUserStorage([ 'whatsapp_phone' => $phone ]);
288 288
 
289 289
                     return $this->askLocation();
290 290
                 });
@@ -302,7 +302,7 @@  discard block
 block discarded – undo
302 302
     {
303 303
         $this->displayValidationErrorMessage($validationErrorMessage);
304 304
 
305
-        return $this->askRenderable('conversations.register-customer.ask-location', function () {
305
+        return $this->askRenderable('conversations.register-customer.ask-location', function() {
306 306
             $latitude = $this->getMessagePayload('location.latitude');
307 307
             $longitude = $this->getMessagePayload('location.longitude');
308 308
 
@@ -323,11 +323,11 @@  discard block
 block discarded – undo
323 323
             ]);
324 324
 
325 325
             return $this->askDataConfirmation();
326
-        }, additionalParameters: ['reply_markup' => json_encode([
327
-            'keyboard' => [[['text' => '
Please login to merge, or discard this patch.
app/Conversations/ExchangeConversation.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -88,12 +88,12 @@  discard block
 block discarded – undo
88 88
                 Button::create(view('conversations.register-customer.reply-customer_data-no')->render())->value('no'),
89 89
             ]);
90 90
 
91
-        return $this->ask($question, next: function (Answer $answer) use ($customer) {
91
+        return $this->ask($question, next: function(Answer $answer) use ($customer) {
92 92
             if (!$answer->isInteractiveMessageReply()) {
93 93
                 return;
94 94
             }
95 95
 
96
-            if (!in_array($value = $answer->getValue(), ['yes', 'no'])) {
96
+            if (!in_array($value = $answer->getValue(), [ 'yes', 'no' ])) {
97 97
                 return $this->displayCustomerData($customer, $this->fallbackMessage($answer->getText()));
98 98
             }
99 99
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
             $additionalParameters = $keyboard->toArray()
137 137
         );
138 138
 
139
-        return $this->getBot()->storeConversation($this, next: function (Answer $answer) use ($response, $customer, $denominations) {
139
+        return $this->getBot()->storeConversation($this, next: function(Answer $answer) use ($response, $customer, $denominations) {
140 140
             if (!$answer->isInteractiveMessageReply()) {
141 141
                 return;
142 142
             }
@@ -149,8 +149,8 @@  discard block
 block discarded – undo
149 149
             }
150 150
 
151 151
             /** @var \App\Models\Order $order */
152
-            $order = Order::findOrCreateFromCode($this->getUserStorage('order_code'), $customer, function (Order $order) {
153
-                $this->setUserStorage(['order_code' => $order->code]);
152
+            $order = Order::findOrCreateFromCode($this->getUserStorage('order_code'), $customer, function(Order $order) {
153
+                $this->setUserStorage([ 'order_code' => $order->code ]);
154 154
             });
155 155
 
156 156
             if ($order->isMaximumTotalOrderExceeded()) {
@@ -211,7 +211,7 @@  discard block
 block discarded – undo
211 211
             $additionalParameters = $keyboard->toArray()
212 212
         );
213 213
 
214
-        return $this->getBot()->storeConversation($this, next: function (Answer $answer) use ($response, $order, $denomination, $branches) {
214
+        return $this->getBot()->storeConversation($this, next: function(Answer $answer) use ($response, $order, $denomination, $branches) {
215 215
             if (!$answer->isInteractiveMessageReply()) {
216 216
                 return;
217 217
             }
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
         $keyboard = Keyboard::create(Keyboard::TYPE_INLINE)->resizeKeyboard();
247 247
         $unit = Str::lower($denomination->type->label);
248 248
 
249
-        collect($denomination->range_order_bundle)->chunk(3)->map(function (Collection $quantities) use ($keyboard, $unit) {
250
-            $keyboard->addRow(...$quantities->map(fn ($quantity) => KeyboardButton::create(
249
+        collect($denomination->range_order_bundle)->chunk(3)->map(function(Collection $quantities) use ($keyboard, $unit) {
250
+            $keyboard->addRow(...$quantities->map(fn($quantity) => KeyboardButton::create(
251 251
                 view('conversations.exchange.reply-bundle_quantity-quantity', compact('quantity'))->render()
252 252
             )->callbackData($quantity))->toArray());
253 253
         });
@@ -263,7 +263,7 @@  discard block
 block discarded – undo
263 263
             $additionalParameters = $keyboard->toArray()
264 264
         );
265 265
 
266
-        return $this->getBot()->storeConversation($this, next: function (Answer $answer) use ($response, $order, $denomination) {
266
+        return $this->getBot()->storeConversation($this, next: function(Answer $answer) use ($response, $order, $denomination) {
267 267
             $this->deleteTelegramMessageFromResponse($response);
268 268
 
269 269
             if ($answer->getValue() === 'bundle_quantity_custom') {
@@ -275,11 +275,11 @@  discard block
 block discarded – undo
275 275
                         ->resizeKeyboard()
276 276
                         ->oneTimeKeyboard()
277 277
                         ->addRow(KeyboardButton::create(
278
-                            $backToDenominationOption = trim(view('components.conversations.back', ['text' => 'opsi nominal'])->render())
278
+                            $backToDenominationOption = trim(view('components.conversations.back', [ 'text' => 'opsi nominal' ])->render())
279 279
                         )->callbackData('back_to_denomination_option'))->toArray()
280 280
                 );
281 281
 
282
-                return $this->getBot()->storeConversation($this, function (Answer $answer) use ($response2, $order, $denomination, $backToDenominationOption) {
282
+                return $this->getBot()->storeConversation($this, function(Answer $answer) use ($response2, $order, $denomination, $backToDenominationOption) {
283 283
                     $this->deleteTelegramMessageFromResponse($response2);
284 284
 
285 285
                     if ($answer->getText() === $backToDenominationOption) {
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
             $additionalParameters = $keyboard->toArray()
354 354
         );
355 355
 
356
-        return $this->getBot()->storeConversation($this, next: function (Answer $answer) use ($response, $responseConfirmOrder, $order) {
356
+        return $this->getBot()->storeConversation($this, next: function(Answer $answer) use ($response, $responseConfirmOrder, $order) {
357 357
             $this->deleteTelegramMessageFromResponse($response);
358 358
 
359 359
             switch ($answer->getValue()) {
Please login to merge, or discard this patch.
app/Conversations/HomeConservation.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
         $keyboard = Keyboard::create(Keyboard::TYPE_INLINE)->resizeKeyboard();
26 26
 
27 27
         foreach (static::conversations(withoutStartCommand: true) as $conversation) {
28
-            $commands = Arr::wrap($conversation['command']);
28
+            $commands = Arr::wrap($conversation[ 'command' ]);
29 29
 
30 30
             $keyboard->addRow(KeyboardButton::create(Arr::last($commands))
31 31
                 ->callbackData(Arr::first($commands))
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
             $additionalParameters = $keyboard->toArray()
38 38
         );
39 39
 
40
-        return $this->getBot()->storeConversation($this, next: function (Answer $answer) use ($response) {
40
+        return $this->getBot()->storeConversation($this, next: function(Answer $answer) use ($response) {
41 41
             if (!$answer->isInteractiveMessageReply()) {
42 42
                 return;
43 43
             }
@@ -60,13 +60,13 @@  discard block
 block discarded – undo
60 60
      */
61 61
     protected function getConversation(string $name): ?Conversation
62 62
     {
63
-        if (!$conversation = static::conversations(withoutStartCommand: true)->first(fn ($conversation) =>
64
-            in_array($name, Arr::wrap($conversation['command']))
63
+        if (!$conversation = static::conversations(withoutStartCommand: true)->first(fn($conversation) =>
64
+            in_array($name, Arr::wrap($conversation[ 'command' ]))
65 65
         )) {
66 66
             return null;
67 67
         }
68 68
 
69
-        return value($conversation['handler']);
69
+        return value($conversation[ 'handler' ]);
70 70
     }
71 71
 
72 72
     /**
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
         $conversations = collect([
83 83
             [
84 84
                 'command' => 'start',
85
-                'handler' => fn () => new StartConservation,
85
+                'handler' => fn() => new StartConservation,
86 86
                 'description' => 'Memulai percakapan',
87 87
             ],
88 88
             [
@@ -90,7 +90,7 @@  discard block
 block discarded – undo
90 90
                     'exchange',
91 91
                     view('conversations.home.reply-menu-exchange')->render(),
92 92
                 ],
93
-                'handler' => fn () => new ExchangeConversation,
93
+                'handler' => fn() => new ExchangeConversation,
94 94
                 'description' => 'Melakukan transaksi penukaran uang',
95 95
             ],
96 96
             [
@@ -98,7 +98,7 @@  discard block
 block discarded – undo
98 98
                     'help',
99 99
                     view('conversations.home.reply-menu-help')->render(),
100 100
                 ],
101
-                'handler' => fn () => new HelpConversation,
101
+                'handler' => fn() => new HelpConversation,
102 102
                 'description' => 'Panduan cara menggunakan chatbot ini',
103 103
             ],
104 104
             [
@@ -106,7 +106,7 @@  discard block
 block discarded – undo
106 106
                     'login',
107 107
                     view('conversations.home.reply-menu-login')->render(),
108 108
                 ],
109
-                'handler' => fn () => new LoginConversation,
109
+                'handler' => fn() => new LoginConversation,
110 110
                 'description' => 'Mendaftarkan Chat ID Telegram pada akun (khusus admin dan staf)',
111 111
                 'is_hidden' => true,
112 112
             ],
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
                     'logout',
116 116
                     view('conversations.home.reply-menu-logout')->render(),
117 117
                 ],
118
-                'handler' => fn () => new LogoutConversation,
118
+                'handler' => fn() => new LogoutConversation,
119 119
                 'description' => 'Menghapus Chat ID Telegram pada akun (khusus admin dan staf)',
120 120
                 'is_hidden' => true,
121 121
             ],
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
                     'ask_telegram_chat_id',
125 125
                     view('conversations.home.reply-menu-ask_telegram_chat_id')->render(),
126 126
                 ],
127
-                'handler' => fn () => new AskTelegramChatIdConversation,
127
+                'handler' => fn() => new AskTelegramChatIdConversation,
128 128
                 'description' => 'Mengetahui Chat ID Telegram anda',
129 129
                 'is_hidden' => true,
130 130
             ],
@@ -133,21 +133,21 @@  discard block
 block discarded – undo
133 133
                     'check_order_status',
134 134
                     view('conversations.home.reply-menu-check_order_status')->render(),
135 135
                 ],
136
-                'handler' => fn () => new CheckOrderStatusConversation,
136
+                'handler' => fn() => new CheckOrderStatusConversation,
137 137
                 'description' => 'Mengetahui status transaksi penukaran uang anda',
138 138
                 'is_hidden' => true,
139 139
             ],
140 140
         ]);
141 141
 
142 142
         if ($withoutStartCommand) {
143
-            $conversations = $conversations->reject(fn (array $conversation) =>
144
-                in_array('start', Arr::wrap($conversation['command']))
143
+            $conversations = $conversations->reject(fn(array $conversation) =>
144
+                in_array('start', Arr::wrap($conversation[ 'command' ]))
145 145
             );
146 146
         }
147 147
 
148 148
         if (!$withHidden) {
149
-            $conversations = $conversations->reject(fn (array $conversation) =>
150
-                ($conversation['is_hidden'] ?? false)
149
+            $conversations = $conversations->reject(fn(array $conversation) =>
150
+                ($conversation[ 'is_hidden' ] ?? false)
151 151
             );
152 152
         }
153 153
 
Please login to merge, or discard this patch.
app/Http/Resources/DataTables/OrderResource.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,16 +17,16 @@
 block discarded – undo
17 17
      */
18 18
     public function toArray($request)
19 19
     {
20
-        $elements = [];
20
+        $elements = [ ];
21 21
 
22 22
         if ($request->user()->can('view', $this->resource)) {
23
-            $elements[] = view('components.datatables.link-show', [
23
+            $elements[ ] = view('components.datatables.link-show', [
24 24
                 'url' => route('admin.order.show', $this->resource),
25 25
             ])->render();
26 26
         }
27 27
 
28 28
         if ($request->user()->can('delete', $this->resource)) {
29
-            $elements[] = view('components.datatables.link-destroy', [
29
+            $elements[ ] = view('components.datatables.link-destroy', [
30 30
                 'url' => route('admin.order.destroy', $this->resource),
31 31
             ])->render();
32 32
         }
Please login to merge, or discard this patch.
app/Http/Requests/Report/Order/SearchRequest.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
     public function rules()
41 41
     {
42 42
         return [
43
-            'start_date' => 'required|date_format:Y-m-d|after_or_equal:' . Carbon::today()->startOfMonth()->format('Y-m-d'),
44
-            'end_date' => 'required|date_format:Y-m-d|before_or_equal:' . Carbon::today()->endOfMonth()->format('Y-m-d'),
43
+            'start_date' => 'required|date_format:Y-m-d|after_or_equal:'.Carbon::today()->startOfMonth()->format('Y-m-d'),
44
+            'end_date' => 'required|date_format:Y-m-d|before_or_equal:'.Carbon::today()->endOfMonth()->format('Y-m-d'),
45 45
         ];
46 46
     }
47 47
 
@@ -53,9 +53,9 @@  discard block
 block discarded – undo
53 53
      */
54 54
     protected function parseDaterange(string $value): array
55 55
     {
56
-        return tap(array_pad(explode(' - ', $value), 2, null), function (array $daterange) {
57
-            $this->start_date = Carbon::parse($daterange[0]);
58
-            $this->end_date = Carbon::parse($daterange[1]);
56
+        return tap(array_pad(explode(' - ', $value), 2, null), function(array $daterange) {
57
+            $this->start_date = Carbon::parse($daterange[ 0 ]);
58
+            $this->end_date = Carbon::parse($daterange[ 1 ]);
59 59
         });
60 60
     }
61 61
 }
Please login to merge, or discard this patch.
app/Http/Requests/OrderStatus/StoreScheduledRequest.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
-            'branch_id' => 'sometimes|nullable|exists:' . Branch::class . ',id',
17
-            'user_id' => 'sometimes|nullable|exists:' . User::class . ',id',
16
+            'branch_id' => 'sometimes|nullable|exists:'.Branch::class.',id',
17
+            'user_id' => 'sometimes|nullable|exists:'.User::class.',id',
18 18
             'schedule_date' => 'sometimes|nullable|after_or_equal:today',
19 19
             'order_status.note' => 'sometimes|nullable|string|max:255',
20 20
         ];
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/OrderController.php 1 patch
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -47,25 +47,25 @@  discard block
 block discarded – undo
47 47
         $this->authorize('viewAny', Order::class);
48 48
 
49 49
         return DataTables::eloquent(Order::query()->with('user:id,fullname'))
50
-            ->setTransformer(fn ($model) => OrderResource::make($model)->resolve())
51
-            ->orderColumn('customer_fullname', function ($query, $direction) {
50
+            ->setTransformer(fn($model) => OrderResource::make($model)->resolve())
51
+            ->orderColumn('customer_fullname', function($query, $direction) {
52 52
                 $query->join('customers', 'orders.customer_id', '=', 'customers.id')
53 53
                     ->select('orders.*', 'customers.id as customer_id', 'customers.fullname as customer_fullname')
54 54
                     ->orderBy('customers.fullname', $direction);
55 55
             })
56
-            ->filterColumn('customer_fullname', function ($query, $keyword) {
57
-                $query->whereHas('customer', function ($query) use ($keyword) {
58
-                    $query->where('fullname', 'like', '%' . $keyword . '%');
56
+            ->filterColumn('customer_fullname', function($query, $keyword) {
57
+                $query->whereHas('customer', function($query) use ($keyword) {
58
+                    $query->where('fullname', 'like', '%'.$keyword.'%');
59 59
                 });
60 60
             })
61
-            ->orderColumn('status', function ($query, $direction) {
61
+            ->orderColumn('status', function($query, $direction) {
62 62
                 $query->join('order_statuses', 'order_statuses.order_id', '=', 'orders.id')
63 63
                     ->select('orders.*', 'order_statuses.id as order_status_id', 'order_statuses.status as order_status')
64 64
                     ->orderBy('order_statuses.status', $direction);
65 65
             })
66
-            ->filterColumn('status', function ($query, $keyword) {
67
-                $query->whereHas('latestStatus', function ($query) use ($keyword) {
68
-                    $query->where('status', 'like', '%' . $keyword . '%');
66
+            ->filterColumn('status', function($query, $keyword) {
67
+                $query->whereHas('latestStatus', function($query) use ($keyword) {
68
+                    $query->where('status', 'like', '%'.$keyword.'%');
69 69
                 });
70 70
             })
71 71
             ->toJson();
@@ -97,17 +97,17 @@  discard block
 block discarded – undo
97 97
         $alert = [
98 98
             'alert' => [
99 99
                 'type' => 'alert-success',
100
-                'message' => trans('The :resource was created!', ['resource' => trans('admin-lang.order')]),
100
+                'message' => trans('The :resource was created!', [ 'resource' => trans('admin-lang.order') ]),
101 101
             ],
102 102
         ];
103 103
 
104 104
         try {
105
-            $order = DB::transaction(function () use ($request) {
105
+            $order = DB::transaction(function() use ($request) {
106 106
                 $order = $request->getOrder();
107 107
 
108 108
                 $order->setCustomerRelationValue($request->getCustomer());
109
-                transform($request->getUser(), fn (User $user) => $order->setUserRelationValue($user));
110
-                transform($request->getBranch(), fn (Branch $branch) => $order->setBranchRelationValue($branch));
109
+                transform($request->getUser(), fn(User $user) => $order->setUserRelationValue($user));
110
+                transform($request->getBranch(), fn(Branch $branch) => $order->setBranchRelationValue($branch));
111 111
 
112 112
                 $order->save();
113 113
 
@@ -140,8 +140,8 @@  discard block
 block discarded – undo
140 140
     public function show(Order $order)
141 141
     {
142 142
         $order->load([
143
-            'statuses' => fn (Relation $query) => $query->latest(),
144
-            'items' => fn (Relation $query) => $query->with('denomination'),
143
+            'statuses' => fn(Relation $query) => $query->latest(),
144
+            'items' => fn(Relation $query) => $query->with('denomination'),
145 145
         ]);
146 146
 
147 147
         return view('admin.order.show', compact('order'));
@@ -155,12 +155,12 @@  discard block
 block discarded – undo
155 155
      */
156 156
     public function destroy(Order $order)
157 157
     {
158
-        DB::transaction(fn () => $order->delete());
158
+        DB::transaction(fn() => $order->delete());
159 159
 
160 160
         return redirect()->route('admin.order.index')->with([
161 161
             'alert' => [
162 162
                 'type' => 'alert-success',
163
-                'message' => trans('The :resource was deleted!', ['resource' => trans('admin-lang.order')]),
163
+                'message' => trans('The :resource was deleted!', [ 'resource' => trans('admin-lang.order') ]),
164 164
             ],
165 165
         ]);
166 166
     }
@@ -173,8 +173,8 @@  discard block
 block discarded – undo
173 173
      */
174 174
     public function destroyMultiple(Request $request)
175 175
     {
176
-        DB::transaction(function () use ($request) {
177
-            foreach ($request->input('checkbox', []) as $id) {
176
+        DB::transaction(function() use ($request) {
177
+            foreach ($request->input('checkbox', [ ]) as $id) {
178 178
                 $order = Order::find($id, 'id');
179 179
 
180 180
                 $this->authorize('delete', $order);
@@ -186,7 +186,7 @@  discard block
 block discarded – undo
186 186
         return redirect()->route('admin.order.index')->with([
187 187
             'alert' => [
188 188
                 'type' => 'alert-success',
189
-                'message' => trans('The :resource was deleted!', ['resource' => trans('admin-lang.order')]),
189
+                'message' => trans('The :resource was deleted!', [ 'resource' => trans('admin-lang.order') ]),
190 190
             ],
191 191
         ]);
192 192
     }
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/OrderStatusController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -59,12 +59,12 @@  discard block
 block discarded – undo
59 59
         switch ($enumOrderStatus) {
60 60
             case EnumOrderStatus::scheduled():
61 61
                 $icon = 'fa-calendar-plus';
62
-                $title = trans('Create :name', ['name' => __('Schedule Date')]);
62
+                $title = trans('Create :name', [ 'name' => __('Schedule Date') ]);
63 63
                 break;
64 64
 
65 65
             case EnumOrderStatus::rescheduled():
66 66
                 $icon = 'fa-calendar-week';
67
-                $title = trans('Create :name', ['name' => __('Reschedule Date')]);
67
+                $title = trans('Create :name', [ 'name' => __('Reschedule Date') ]);
68 68
                 break;
69 69
 
70 70
             case EnumOrderStatus::canceled():
@@ -80,8 +80,8 @@  discard block
 block discarded – undo
80 80
 
81 81
         $url = route('admin.order.status.create', compact('order', 'enumOrderStatus'));
82 82
 
83
-        $optionUsers = User::when($order->branch, function (Builder $query) use ($order) {
84
-            $query->whereHas('branch', function (Builder $query) use ($order) {
83
+        $optionUsers = User::when($order->branch, function(Builder $query) use ($order) {
84
+            $query->whereHas('branch', function(Builder $query) use ($order) {
85 85
                 $query->whereKey($order->branch->getKey());
86 86
             });
87 87
         })->pluck('fullname', 'id');
@@ -121,7 +121,7 @@  discard block
 block discarded – undo
121 121
         return redirect()->route('admin.order.show', $order)->with([
122 122
             'alert' => [
123 123
                 'type' => 'alert-success',
124
-                'message' => trans('The :resource was updated!', ['resource' => trans('admin-lang.order')]),
124
+                'message' => trans('The :resource was updated!', [ 'resource' => trans('admin-lang.order') ]),
125 125
             ],
126 126
         ]);
127 127
     }
@@ -150,7 +150,7 @@  discard block
 block discarded – undo
150 150
         return redirect()->route('admin.order.show', $order)->with([
151 151
             'alert' => [
152 152
                 'type' => 'alert-success',
153
-                'message' => trans('The :resource was deleted!', ['resource' => trans('Order Status')]),
153
+                'message' => trans('The :resource was deleted!', [ 'resource' => trans('Order Status') ]),
154 154
             ],
155 155
         ]);
156 156
     }
Please login to merge, or discard this patch.
app/Http/Controllers/Admin/Report/OrderController.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -37,28 +37,28 @@  discard block
 block discarded – undo
37 37
 
38 38
         $query = Order::query()->with('user:id,fullname')
39 39
             ->has('items')
40
-            ->whereBetween('created_at', [$request->start_date, $request->end_date]);
40
+            ->whereBetween('created_at', [ $request->start_date, $request->end_date ]);
41 41
 
42 42
         return DataTables::eloquent($query)
43
-            ->setTransformer(fn ($model) => OrderResource::make($model)->resolve())
44
-            ->orderColumn('customer_fullname', function ($query, $direction) {
43
+            ->setTransformer(fn($model) => OrderResource::make($model)->resolve())
44
+            ->orderColumn('customer_fullname', function($query, $direction) {
45 45
                 $query->join('customers', 'orders.customer_id', '=', 'customers.id')
46 46
                     ->select('orders.*', 'customers.id as customer_id', 'customers.fullname as customer_fullname')
47 47
                     ->orderBy('customers.fullname', $direction);
48 48
             })
49
-            ->filterColumn('customer_fullname', function ($query, $keyword) {
50
-                $query->whereHas('customer', function ($query) use ($keyword) {
51
-                    $query->where('fullname', 'like', '%' . $keyword . '%');
49
+            ->filterColumn('customer_fullname', function($query, $keyword) {
50
+                $query->whereHas('customer', function($query) use ($keyword) {
51
+                    $query->where('fullname', 'like', '%'.$keyword.'%');
52 52
                 });
53 53
             })
54
-            ->orderColumn('status', function ($query, $direction) {
54
+            ->orderColumn('status', function($query, $direction) {
55 55
                 $query->join('order_statuses', 'order_statuses.order_id', '=', 'orders.id')
56 56
                     ->select('orders.*', 'order_statuses.id as order_status_id', 'order_statuses.status as order_status')
57 57
                     ->orderBy('order_statuses.status', $direction);
58 58
             })
59
-            ->filterColumn('status', function ($query, $keyword) {
60
-                $query->whereHas('latestStatus', function ($query) use ($keyword) {
61
-                    $query->where('status', 'like', '%' . $keyword . '%');
59
+            ->filterColumn('status', function($query, $keyword) {
60
+                $query->whereHas('latestStatus', function($query) use ($keyword) {
61
+                    $query->where('status', 'like', '%'.$keyword.'%');
62 62
                 });
63 63
             })
64 64
             ->toJson();
@@ -74,8 +74,8 @@  discard block
 block discarded – undo
74 74
     {
75 75
         $query = Item::query()
76 76
             ->with('order.user', 'order.customer', 'denomination')
77
-            ->whereHas('order', function (Builder $query) use ($request) {
78
-                $query->whereBetween('created_at', [$request->start_date, $request->end_date]);
77
+            ->whereHas('order', function(Builder $query) use ($request) {
78
+                $query->whereBetween('created_at', [ $request->start_date, $request->end_date ]);
79 79
             });
80 80
 
81 81
         return new OrderExport($query);
Please login to merge, or discard this patch.