Passed
Push — develop ( 37402c...c02995 )
by Septianata
07:07
created
database/migrations/2021_05_22_000009_create_denominations_table.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@
 block discarded – undo
17 17
      */
18 18
     public function up()
19 19
     {
20
-        Schema::create('denominations', function (Blueprint $table) {
20
+        Schema::create('denominations', function(Blueprint $table) {
21 21
             $table->id();
22 22
 
23 23
             $table->string('code')->unique();
24 24
             $table->string('name');
25 25
             $table->unsignedDecimal('value');
26
-            $table->string('type')->comment('Enum of ' . DenominationType::class);
26
+            $table->string('type')->comment('Enum of '.DenominationType::class);
27 27
             $table->unsignedInteger('quantity_per_bundle');
28 28
             $table->unsignedInteger('minimum_order_bundle');
29 29
             $table->unsignedInteger('maximum_order_bundle');
Please login to merge, or discard this patch.
database/factories/DenominationFactory.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -29,22 +29,22 @@
 block discarded – undo
29 29
         $type = $isCoin ? DenominationType::coin() : DenominationType::banknote();
30 30
 
31 31
         $value = $isCoin
32
-            ? $this->faker->randomElement([100, 200, 500, 1000])
33
-            : $this->faker->randomElement([1000, 2000, 5000, 10000, 20000, 50000, 75000, 100000]);
32
+            ? $this->faker->randomElement([ 100, 200, 500, 1000 ])
33
+            : $this->faker->randomElement([ 1000, 2000, 5000, 10000, 20000, 50000, 75000, 100000 ]);
34 34
 
35 35
         return [
36
-            'code' => $type->value . '-' . $value,
36
+            'code' => $type->value.'-'.$value,
37 37
             'name' => terbilang($value),
38 38
             'value' => $value,
39 39
             'type' => $type,
40
-            'quantity_per_bundle' => $this->faker->randomElement([50, 100, 200]),
40
+            'quantity_per_bundle' => $this->faker->randomElement([ 50, 100, 200 ]),
41 41
             'minimum_order_bundle' => $minimumBundle = $this->faker->numberBetween(1, 10),
42 42
             'maximum_order_bundle' => $this->faker->numberBetween($minimumBundle, 10),
43 43
             'minimum_order_quantity' => $canOrderCustomQuantity ? $minimumQuantity = $this->faker->numberBetween(1, 100) : null,
44 44
             'maximum_order_quantity' => $canOrderCustomQuantity ? $this->faker->numberBetween($minimumQuantity, 100) : null,
45 45
             'can_order_custom_quantity' => $canOrderCustomQuantity,
46 46
             'is_visible' => $this->faker->boolean,
47
-            'image' => UploadedFile::fake()->image($type->value . '-' . $value . '.jpg'),
47
+            'image' => UploadedFile::fake()->image($type->value.'-'.$value.'.jpg'),
48 48
         ];
49 49
     }
50 50
 }
Please login to merge, or discard this patch.
app/Http/Requests/Denomination/UpdateRequest.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -15,10 +15,10 @@  discard block
 block discarded – undo
15 15
     public function rules()
16 16
     {
17 17
         return [
18
-            'code' => ['required', 'string', 'max:255', Rule::unique(Denomination::class)->ignoreModel($this->route('denomination'))],
18
+            'code' => [ 'required', 'string', 'max:255', Rule::unique(Denomination::class)->ignoreModel($this->route('denomination')) ],
19 19
             'name' => 'required|string|max:255',
20 20
             'value' => 'required|numeric|min:0',
21
-            'type' => 'required|enum:' . DenominationType::class,
21
+            'type' => 'required|enum:'.DenominationType::class,
22 22
             'quantity_per_bundle' => 'required|numeric|min:0',
23 23
             'minimum_order_bundle' => 'required|numeric|min:0',
24 24
             'maximum_order_bundle' => 'required|numeric|gte:minimum_order_bundle',
@@ -46,14 +46,14 @@  discard block
 block discarded – undo
46 46
         $model = $this->route('denomination');
47 47
 
48 48
         if ($model->getRawOriginal('image') && $this->hasFile($key)) {
49
-            Storage::delete(Denomination::IMAGE_PATH . '/' . $model->getRawOriginal('image'));
49
+            Storage::delete(Denomination::IMAGE_PATH.'/'.$model->getRawOriginal('image'));
50 50
         }
51 51
 
52 52
         $file = $this->file($key);
53 53
 
54 54
         $file->storeAs(
55 55
             Denomination::IMAGE_PATH,
56
-            $filename = ($this->input('type') . '-' . $this->input('value') . '.' . $file->getClientOriginalExtension())
56
+            $filename = ($this->input('type').'-'.$this->input('value').'.'.$file->getClientOriginalExtension())
57 57
         );
58 58
 
59 59
         return $filename;
Please login to merge, or discard this patch.
app/Http/Requests/Denomination/StoreRequest.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -13,10 +13,10 @@  discard block
 block discarded – undo
13 13
     public function rules()
14 14
     {
15 15
         return [
16
-            'code' => 'required|string|max:255|unique:' . Denomination::class,
16
+            'code' => 'required|string|max:255|unique:'.Denomination::class,
17 17
             'name' => 'required|string|max:255',
18 18
             'value' => 'required|numeric|min:0',
19
-            'type' => 'required|enum:' . DenominationType::class,
19
+            'type' => 'required|enum:'.DenominationType::class,
20 20
             'quantity_per_bundle' => 'required|numeric|min:0',
21 21
             'minimum_order_bundle' => 'required|numeric|min:0',
22 22
             'maximum_order_bundle' => 'required|numeric|gte:minimum_order_bundle',
@@ -44,7 +44,7 @@  discard block
 block discarded – undo
44 44
 
45 45
         $file->storeAs(
46 46
             Denomination::IMAGE_PATH,
47
-            $filename = ($this->input('type') . '-' . $this->input('value') . '.' . $file->getClientOriginalExtension())
47
+            $filename = ($this->input('type').'-'.$this->input('value').'.'.$file->getClientOriginalExtension())
48 48
         );
49 49
 
50 50
         return $filename;
Please login to merge, or discard this patch.
app/Conversations/ExchangeConversation.php 1 patch
Spacing   +13 added lines, -13 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
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
     {
121 121
         $this->displayValidationErrorMessage($validationErrorMessage);
122 122
 
123
-        $denominations = Denomination::whereIsVisible()->get(['id', 'code', 'name', 'value']);
123
+        $denominations = Denomination::whereIsVisible()->get([ 'id', 'code', 'name', 'value' ]);
124 124
         $keyboard = Keyboard::create(Keyboard::TYPE_INLINE)->resizeKeyboard();
125 125
 
126 126
         foreach ($denominations as $denomination) {
@@ -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.