Passed
Push — develop ( 9324e6...f3eb57 )
by Septianata
04:31
created
app/Models/Order.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -51,7 +51,7 @@  discard block
 block discarded – undo
51 51
     {
52 52
         $date ??= Carbon::today();
53 53
 
54
-        return $prefix . '-' . $date->format('Ymd') . '-' . Str::random(5);
54
+        return $prefix.'-'.$date->format('Ymd').'-'.Str::random(5);
55 55
     }
56 56
 
57 57
     /**
@@ -64,12 +64,12 @@  discard block
 block discarded – undo
64 64
      */
65 65
     public static function findOrCreateFromCode(?string $code, Customer $customer, callable $callable = null)
66 66
     {
67
-        return static::where('code', $code)->firstOr(function () use ($customer, $callable) {
67
+        return static::where('code', $code)->firstOr(function() use ($customer, $callable) {
68 68
             $order = new Order;
69 69
 
70 70
             $order->setCustomerRelationValue($customer)->save();
71 71
 
72
-            $orderStatus = new ModelOrderStatus(['status' => EnumOrderStatus::draft()]);
72
+            $orderStatus = new ModelOrderStatus([ 'status' => EnumOrderStatus::draft() ]);
73 73
 
74 74
             $order->statuses()->save(
75 75
                 $orderStatus->setIssuerableRelationValue($customer)
Please login to merge, or discard this patch.
app/Models/Concerns/Order/Event.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -19,13 +19,13 @@
 block discarded – undo
19 19
      */
20 20
     protected static function bootEvent()
21 21
     {
22
-        static::creating(function (Order $model) {
22
+        static::creating(function(Order $model) {
23 23
             if (is_null($model->code)) {
24 24
                 $model->code = $model->generateCode();
25 25
             }
26 26
         });
27 27
 
28
-        static::deleting(function (Order $model) {
28
+        static::deleting(function(Order $model) {
29 29
             $model->items->map->delete();
30 30
         });
31 31
     }
Please login to merge, or discard this patch.
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.