@@ -18,22 +18,22 @@ |
||
18 | 18 | */ |
19 | 19 | public function toArray($request) |
20 | 20 | { |
21 | - $elements = []; |
|
21 | + $elements = [ ]; |
|
22 | 22 | |
23 | 23 | if ($request->user()->can('view', $this->resource)) { |
24 | - $elements[] = view('components.datatables.link-show', [ |
|
24 | + $elements[ ] = view('components.datatables.link-show', [ |
|
25 | 25 | 'url' => route('admin.branch.show', $this->resource), |
26 | 26 | ])->render(); |
27 | 27 | } |
28 | 28 | |
29 | 29 | if ($request->user()->can('update', $this->resource)) { |
30 | - $elements[] = view('components.datatables.link-edit', [ |
|
30 | + $elements[ ] = view('components.datatables.link-edit', [ |
|
31 | 31 | 'url' => route('admin.branch.edit', $this->resource), |
32 | 32 | ])->render(); |
33 | 33 | } |
34 | 34 | |
35 | 35 | if ($request->user()->can('delete', $this->resource)) { |
36 | - $elements[] = view('components.datatables.link-destroy', [ |
|
36 | + $elements[ ] = view('components.datatables.link-destroy', [ |
|
37 | 37 | 'url' => route('admin.branch.destroy', $this->resource), |
38 | 38 | ])->render(); |
39 | 39 | } |
@@ -17,22 +17,22 @@ |
||
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.user.show', $this->resource), |
25 | 25 | ])->render(); |
26 | 26 | } |
27 | 27 | |
28 | 28 | if ($request->user()->can('update', $this->resource)) { |
29 | - $elements[] = view('components.datatables.link-edit', [ |
|
29 | + $elements[ ] = view('components.datatables.link-edit', [ |
|
30 | 30 | 'url' => route('admin.user.edit', $this->resource), |
31 | 31 | ])->render(); |
32 | 32 | } |
33 | 33 | |
34 | 34 | if ($request->user()->can('delete', $this->resource)) { |
35 | - $elements[] = view('components.datatables.link-destroy', [ |
|
35 | + $elements[ ] = view('components.datatables.link-destroy', [ |
|
36 | 36 | 'url' => route('admin.user.destroy', $this->resource), |
37 | 37 | ])->render(); |
38 | 38 | } |
@@ -17,16 +17,16 @@ |
||
17 | 17 | */ |
18 | 18 | public function toArray($request) |
19 | 19 | { |
20 | - $elements = []; |
|
20 | + $elements = [ ]; |
|
21 | 21 | |
22 | 22 | if ($request->user()->can('update', $this->resource)) { |
23 | - $elements[] = view('components.datatables.link-edit', [ |
|
23 | + $elements[ ] = view('components.datatables.link-edit', [ |
|
24 | 24 | 'url' => route('admin.role.edit', $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.role.destroy', $this->resource), |
31 | 31 | ])->render(); |
32 | 32 | } |
@@ -18,28 +18,28 @@ |
||
18 | 18 | */ |
19 | 19 | public function toArray($request) |
20 | 20 | { |
21 | - $elements = []; |
|
21 | + $elements = [ ]; |
|
22 | 22 | |
23 | 23 | if ($request->user()->can('create', Order::class)) { |
24 | - $elements[] = view('admin.customer.form-create-order', [ |
|
24 | + $elements[ ] = view('admin.customer.form-create-order', [ |
|
25 | 25 | 'customer' => $this->resource, |
26 | 26 | ])->render(); |
27 | 27 | } |
28 | 28 | |
29 | 29 | if ($request->user()->can('view', $this->resource)) { |
30 | - $elements[] = view('components.datatables.link-show', [ |
|
30 | + $elements[ ] = view('components.datatables.link-show', [ |
|
31 | 31 | 'url' => route('admin.customer.show', $this->resource), |
32 | 32 | ])->render(); |
33 | 33 | } |
34 | 34 | |
35 | 35 | if ($request->user()->can('update', $this->resource)) { |
36 | - $elements[] = view('components.datatables.link-edit', [ |
|
36 | + $elements[ ] = view('components.datatables.link-edit', [ |
|
37 | 37 | 'url' => route('admin.customer.edit', $this->resource), |
38 | 38 | ])->render(); |
39 | 39 | } |
40 | 40 | |
41 | 41 | if ($request->user()->can('delete', $this->resource)) { |
42 | - $elements[] = view('components.datatables.link-destroy', [ |
|
42 | + $elements[ ] = view('components.datatables.link-destroy', [ |
|
43 | 43 | 'url' => route('admin.customer.destroy', $this->resource), |
44 | 44 | ])->render(); |
45 | 45 | } |
@@ -22,21 +22,21 @@ |
||
22 | 22 | $user = Auth::user(); |
23 | 23 | |
24 | 24 | return [ |
25 | - 'username' => ['required', 'string', 'max:255', Rule::unique(User::class)->ignoreModel($user)], |
|
25 | + 'username' => [ 'required', 'string', 'max:255', Rule::unique(User::class)->ignoreModel($user) ], |
|
26 | 26 | 'fullname' => 'required|string|max:255', |
27 | - 'gender' => 'sometimes|nullable|enum:' . Gender::class, |
|
28 | - 'email' => ['required', 'string', 'email', 'max:255', Rule::unique(User::class)->ignoreModel($user)], |
|
27 | + 'gender' => 'sometimes|nullable|enum:'.Gender::class, |
|
28 | + 'email' => [ 'required', 'string', 'email', 'max:255', Rule::unique(User::class)->ignoreModel($user) ], |
|
29 | 29 | 'phone_country' => 'sometimes|in:ID', |
30 | - 'phone' => ['required', 'string', 'phone:ID', function ($attribute, $phone, $fail) use ($user) { |
|
30 | + 'phone' => [ 'required', 'string', 'phone:ID', function($attribute, $phone, $fail) use ($user) { |
|
31 | 31 | $userCount = User::where($attribute, PhoneNumber::make($phone, request()->input('phone_country', env('PHONE_COUNTRY', 'ID')))->formatE164()) |
32 | 32 | ->where($user->getKeyName(), '!=', $user->getKey()) |
33 | 33 | ->count(); |
34 | 34 | |
35 | 35 | if ($userCount > 0) { |
36 | - $fail(trans('validation.unique', ['attribute' => static::getAttributes()[$attribute]])); |
|
36 | + $fail(trans('validation.unique', [ 'attribute' => static::getAttributes()[ $attribute ] ])); |
|
37 | 37 | } |
38 | - }], |
|
39 | - 'password' => ['sometimes', 'nullable', 'confirmed', Rules\Password::defaults()], |
|
38 | + } ], |
|
39 | + 'password' => [ 'sometimes', 'nullable', 'confirmed', Rules\Password::defaults() ], |
|
40 | 40 | ]; |
41 | 41 | } |
42 | 42 |
@@ -15,8 +15,8 @@ discard block |
||
15 | 15 | */ |
16 | 16 | public static function getRules() |
17 | 17 | { |
18 | - $phoneRule = function () { |
|
19 | - return ['required', 'string', 'phone:ID', function ($attribute, $phone, $fail) { |
|
18 | + $phoneRule = function() { |
|
19 | + return [ 'required', 'string', 'phone:ID', function($attribute, $phone, $fail) { |
|
20 | 20 | $country = $attribute === 'phone' |
21 | 21 | ? request()->input('phone_country', env('PHONE_COUNTRY', 'ID')) |
22 | 22 | : request()->input('whatsapp_phone_country', env('PHONE_COUNTRY', 'ID')); |
@@ -25,26 +25,26 @@ discard block |
||
25 | 25 | ->count(); |
26 | 26 | |
27 | 27 | if ($user > 0) { |
28 | - $fail(trans('validation.unique', ['attribute' => static::getAttributes()[$attribute]])); |
|
28 | + $fail(trans('validation.unique', [ 'attribute' => static::getAttributes()[ $attribute ] ])); |
|
29 | 29 | } |
30 | - }]; |
|
30 | + } ]; |
|
31 | 31 | }; |
32 | 32 | |
33 | 33 | return [ |
34 | - 'telegram_chat_id' => 'required|string|max:255|unique:' . Customer::class, |
|
35 | - 'username' => ['required', 'string', 'max:255', new NotTelegramImage], |
|
36 | - 'fullname' => ['required', 'string', 'max:255', new NotTelegramImage], |
|
37 | - 'gender' => 'sometimes|nullable|enum:' . Gender::class, |
|
38 | - 'email' => ['required', 'string', 'email', 'max:255', 'unique:' . Customer::class, new NotTelegramImage], |
|
34 | + 'telegram_chat_id' => 'required|string|max:255|unique:'.Customer::class, |
|
35 | + 'username' => [ 'required', 'string', 'max:255', new NotTelegramImage ], |
|
36 | + 'fullname' => [ 'required', 'string', 'max:255', new NotTelegramImage ], |
|
37 | + 'gender' => 'sometimes|nullable|enum:'.Gender::class, |
|
38 | + 'email' => [ 'required', 'string', 'email', 'max:255', 'unique:'.Customer::class, new NotTelegramImage ], |
|
39 | 39 | 'phone_country' => 'sometimes|in:ID', |
40 | - 'phone' => [value($phoneRule), new NotTelegramImage], |
|
40 | + 'phone' => [ value($phoneRule), new NotTelegramImage ], |
|
41 | 41 | 'whatsapp_phone_country' => 'sometimes|in:ID', |
42 | - 'whatsapp_phone' => [value($phoneRule), new NotTelegramImage], |
|
43 | - 'account_number' => ['required_without:identitycard_number', new NotTelegramImage(canBeNull: true)] + (request()->filled('account_number') ? ['numeric'] : []), |
|
44 | - 'identitycard_number' => ['required_without:account_number', new NotTelegramImage(canBeNull: true)] + (request()->filled('identitycard_number') ? ['numeric'] : []), |
|
42 | + 'whatsapp_phone' => [ value($phoneRule), new NotTelegramImage ], |
|
43 | + 'account_number' => [ 'required_without:identitycard_number', new NotTelegramImage(canBeNull: true) ] + (request()->filled('account_number') ? [ 'numeric' ] : [ ]), |
|
44 | + 'identitycard_number' => [ 'required_without:account_number', new NotTelegramImage(canBeNull : true) ] + (request()->filled('identitycard_number') ? [ 'numeric' ] : [ ]), |
|
45 | 45 | 'identitycard_image' => 'sometimes|nullable|image', |
46 | - 'location_latitude' => ['required', 'numeric', new NotTelegramImage(false)], |
|
47 | - 'location_longitude' => ['required', 'numeric', new NotTelegramImage(false)], |
|
46 | + 'location_latitude' => [ 'required', 'numeric', new NotTelegramImage(false) ], |
|
47 | + 'location_longitude' => [ 'required', 'numeric', new NotTelegramImage(false) ], |
|
48 | 48 | ]; |
49 | 49 | } |
50 | 50 | |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | $file->storeAs( |
66 | 66 | Customer::IDENTITYCARD_IMAGE_PATH, |
67 | - $filename = (Str::random() . '.' . $file->getClientOriginalExtension()) |
|
67 | + $filename = (Str::random().'.'.$file->getClientOriginalExtension()) |
|
68 | 68 | ); |
69 | 69 | |
70 | 70 | return $filename; |
@@ -17,8 +17,8 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public static function getRules() |
19 | 19 | { |
20 | - $phoneRule = function () { |
|
21 | - return ['required', 'string', 'phone:ID', function ($attribute, $phone, $fail) { |
|
20 | + $phoneRule = function() { |
|
21 | + return [ 'required', 'string', 'phone:ID', function($attribute, $phone, $fail) { |
|
22 | 22 | $country = $attribute === 'phone' |
23 | 23 | ? request()->input('phone_country', env('PHONE_COUNTRY', 'ID')) |
24 | 24 | : request()->input('whatsapp_phone_country', env('PHONE_COUNTRY', 'ID')); |
@@ -28,13 +28,13 @@ discard block |
||
28 | 28 | ->count(); |
29 | 29 | |
30 | 30 | if ($user > 0) { |
31 | - $fail(trans('validation.unique', ['attribute' => static::getAttributes()[$attribute]])); |
|
31 | + $fail(trans('validation.unique', [ 'attribute' => static::getAttributes()[ $attribute ] ])); |
|
32 | 32 | } |
33 | - }]; |
|
33 | + } ]; |
|
34 | 34 | }; |
35 | 35 | |
36 | 36 | return [ |
37 | - 'telegram_chat_id' => ['required', 'string', 'max:255', function ($attribute, $telegram_chat_id, $fail) { |
|
37 | + 'telegram_chat_id' => [ 'required', 'string', 'max:255', function($attribute, $telegram_chat_id, $fail) { |
|
38 | 38 | $validator = Validator::make(compact('telegram_chat_id'), [ |
39 | 39 | $attribute => Rule::unique(Customer::class)->ignore($telegram_chat_id, $attribute), |
40 | 40 | ]); |
@@ -42,11 +42,11 @@ discard block |
||
42 | 42 | if ($validator->fails()) { |
43 | 43 | $fail(trans('validation.unique', compact('attribute'))); |
44 | 44 | } |
45 | - }], |
|
46 | - 'username' => ['required', 'string', 'max:255', new NotTelegramImage], |
|
47 | - 'fullname' => ['required', 'string', 'max:255', new NotTelegramImage], |
|
48 | - 'gender' => 'sometimes|nullable|enum:' . Gender::class, |
|
49 | - 'email' => ['required', 'string', 'email', 'max:255', function ($attribute, $email, $fail) { |
|
45 | + } ], |
|
46 | + 'username' => [ 'required', 'string', 'max:255', new NotTelegramImage ], |
|
47 | + 'fullname' => [ 'required', 'string', 'max:255', new NotTelegramImage ], |
|
48 | + 'gender' => 'sometimes|nullable|enum:'.Gender::class, |
|
49 | + 'email' => [ 'required', 'string', 'email', 'max:255', function($attribute, $email, $fail) { |
|
50 | 50 | $validator = Validator::make(compact('email'), [ |
51 | 51 | $attribute => Rule::unique(Customer::class)->ignore($email, $attribute), |
52 | 52 | ]); |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | if ($validator->fails()) { |
55 | 55 | $fail(trans('validation.unique', compact('attribute'))); |
56 | 56 | } |
57 | - }, new NotTelegramImage], |
|
57 | + }, new NotTelegramImage ], |
|
58 | 58 | 'phone_country' => 'sometimes|in:ID', |
59 | - 'phone' => [value($phoneRule), new NotTelegramImage], |
|
59 | + 'phone' => [ value($phoneRule), new NotTelegramImage ], |
|
60 | 60 | 'whatsapp_phone_country' => 'sometimes|in:ID', |
61 | - 'whatsapp_phone' => [value($phoneRule), new NotTelegramImage], |
|
62 | - 'account_number' => ['required_without:identitycard_number', new NotTelegramImage] + (request()->filled('account_number') ? ['numeric'] : []), |
|
63 | - 'identitycard_number' => ['required_without:account_number', new NotTelegramImage] + (request()->filled('identitycard_number') ? ['numeric'] : []), |
|
61 | + 'whatsapp_phone' => [ value($phoneRule), new NotTelegramImage ], |
|
62 | + 'account_number' => [ 'required_without:identitycard_number', new NotTelegramImage ] + (request()->filled('account_number') ? [ 'numeric' ] : [ ]), |
|
63 | + 'identitycard_number' => [ 'required_without:account_number', new NotTelegramImage ] + (request()->filled('identitycard_number') ? [ 'numeric' ] : [ ]), |
|
64 | 64 | 'identitycard_image' => 'sometimes|nullable|image', |
65 | - 'location_latitude' => ['required', 'numeric', new NotTelegramImage(false)], |
|
66 | - 'location_longitude' => ['required', 'numeric', new NotTelegramImage(false)], |
|
65 | + 'location_latitude' => [ 'required', 'numeric', new NotTelegramImage(false) ], |
|
66 | + 'location_longitude' => [ 'required', 'numeric', new NotTelegramImage(false) ], |
|
67 | 67 | ]; |
68 | 68 | } |
69 | 69 | |
@@ -83,14 +83,14 @@ discard block |
||
83 | 83 | $model = $this->route('customer'); |
84 | 84 | |
85 | 85 | if ($model->getRawOriginal('identitycard_image') && $this->hasFile($key)) { |
86 | - Storage::delete(Customer::IDENTITYCARD_IMAGE_PATH . '/' . $model->getRawOriginal('identitycard_image')); |
|
86 | + Storage::delete(Customer::IDENTITYCARD_IMAGE_PATH.'/'.$model->getRawOriginal('identitycard_image')); |
|
87 | 87 | } |
88 | 88 | |
89 | 89 | $file = $this->file($key); |
90 | 90 | |
91 | 91 | $file->storeAs( |
92 | 92 | Customer::IDENTITYCARD_IMAGE_PATH, |
93 | - $filename = ($this->input('value') . '.' . $file->getClientOriginalExtension()) |
|
93 | + $filename = ($this->input('value').'.'.$file->getClientOriginalExtension()) |
|
94 | 94 | ); |
95 | 95 | |
96 | 96 | return $filename; |
@@ -16,11 +16,11 @@ |
||
16 | 16 | $denominationIds = static::getOrderFromRoute()->items()->pluck('denomination_id'); |
17 | 17 | |
18 | 18 | return [ |
19 | - 'denomination_id' => ['required', 'exists:' . Denomination::class . ',id', Rule::notIn($denominationIds->toArray())], |
|
19 | + 'denomination_id' => [ 'required', 'exists:'.Denomination::class.',id', Rule::notIn($denominationIds->toArray()) ], |
|
20 | 20 | 'bundle_quantity' => [ |
21 | 21 | 'required', 'numeric', |
22 | - 'min:' . static::getDenominationFromRequest()->minimum_order_bundle, |
|
23 | - 'max:' . static::getDenominationFromRequest()->maximum_order_bundle, |
|
22 | + 'min:'.static::getDenominationFromRequest()->minimum_order_bundle, |
|
23 | + 'max:'.static::getDenominationFromRequest()->maximum_order_bundle, |
|
24 | 24 | ], |
25 | 25 | ]; |
26 | 26 | } |
@@ -14,16 +14,16 @@ |
||
14 | 14 | { |
15 | 15 | /** @var \Illuminate\Support\Collection $denominationIds */ |
16 | 16 | $denominationIds = static::getOrderFromRoute()->items()->pluck('denomination_id'); |
17 | - $denominationIds = $denominationIds->reject(fn ($denominationId) => |
|
17 | + $denominationIds = $denominationIds->reject(fn($denominationId) => |
|
18 | 18 | $denominationId == static::getItemFromRoute()->denomination_id |
19 | 19 | ); |
20 | 20 | |
21 | 21 | return [ |
22 | - 'denomination_id' => ['required', 'exists:' . Denomination::class . ',id', Rule::notIn($denominationIds->toArray())], |
|
22 | + 'denomination_id' => [ 'required', 'exists:'.Denomination::class.',id', Rule::notIn($denominationIds->toArray()) ], |
|
23 | 23 | 'bundle_quantity' => [ |
24 | 24 | 'required', 'numeric', |
25 | - 'min:' . static::getDenominationFromRequest()->minimum_order_bundle, |
|
26 | - 'max:' . static::getDenominationFromRequest()->maximum_order_bundle, |
|
25 | + 'min:'.static::getDenominationFromRequest()->minimum_order_bundle, |
|
26 | + 'max:'.static::getDenominationFromRequest()->maximum_order_bundle, |
|
27 | 27 | ], |
28 | 28 | 'quantity_per_bundle' => 'required|numeric|min:1', |
29 | 29 | ]; |