@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | public function datatable() |
31 | 31 | { |
32 | 32 | return DataTables::eloquent(Branch::query()) |
33 | - ->setTransformer(fn ($model) => BranchResource::make($model)->resolve()) |
|
33 | + ->setTransformer(fn($model) => BranchResource::make($model)->resolve()) |
|
34 | 34 | ->toJson(); |
35 | 35 | } |
36 | 36 | |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | return redirect()->route('admin.branch.index')->with([ |
58 | 58 | 'alert' => [ |
59 | 59 | 'type' => 'alert-success', |
60 | - 'message' => trans('The :resource was created!', ['resource' => trans('admin-lang.branch')]), |
|
60 | + 'message' => trans('The :resource was created!', [ 'resource' => trans('admin-lang.branch') ]), |
|
61 | 61 | ], |
62 | 62 | ]); |
63 | 63 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | return redirect()->route('admin.branch.index')->with([ |
88 | 88 | 'alert' => [ |
89 | 89 | 'type' => 'alert-success', |
90 | - 'message' => trans('The :resource was updated!', ['resource' => trans('admin-lang.branch')]), |
|
90 | + 'message' => trans('The :resource was updated!', [ 'resource' => trans('admin-lang.branch') ]), |
|
91 | 91 | ], |
92 | 92 | ]); |
93 | 93 | } |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | return redirect()->route('admin.branch.index')->with([ |
106 | 106 | 'alert' => [ |
107 | 107 | 'type' => 'alert-success', |
108 | - 'message' => trans('The :resource was deleted!', ['resource' => trans('admin-lang.branch')]), |
|
108 | + 'message' => trans('The :resource was deleted!', [ 'resource' => trans('admin-lang.branch') ]), |
|
109 | 109 | ], |
110 | 110 | ]); |
111 | 111 | } |
@@ -118,12 +118,12 @@ discard block |
||
118 | 118 | */ |
119 | 119 | public function destroyMultiple(Request $request) |
120 | 120 | { |
121 | - Branch::destroy($request->input('checkbox', [])); |
|
121 | + Branch::destroy($request->input('checkbox', [ ])); |
|
122 | 122 | |
123 | 123 | return redirect()->route('admin.branch.index')->with([ |
124 | 124 | 'alert' => [ |
125 | 125 | 'type' => 'alert-success', |
126 | - 'message' => trans('The :resource was deleted!', ['resource' => trans('admin-lang.branch')]), |
|
126 | + 'message' => trans('The :resource was deleted!', [ 'resource' => trans('admin-lang.branch') ]), |
|
127 | 127 | ], |
128 | 128 | ]); |
129 | 129 | } |
@@ -26,18 +26,18 @@ |
||
26 | 26 | $fieldLongitude = 'address_longitude'; |
27 | 27 | |
28 | 28 | $selectQuery = sprintf( |
29 | - '*, ' . |
|
30 | - '6371 * acos(cos(radians(?)) ' . |
|
31 | - '* cos(radians(%s)) ' . |
|
32 | - '* cos(radians(%s) - radians(?)) ' . |
|
33 | - '+ sin(radians(?)) ' . |
|
29 | + '*, '. |
|
30 | + '6371 * acos(cos(radians(?)) '. |
|
31 | + '* cos(radians(%s)) '. |
|
32 | + '* cos(radians(%s) - radians(?)) '. |
|
33 | + '+ sin(radians(?)) '. |
|
34 | 34 | '* sin(radians(%s))) AS distance', |
35 | 35 | $fieldLatitude, $fieldLongitude, $fieldLatitude |
36 | 36 | ); |
37 | 37 | |
38 | 38 | return $query->selectRaw( |
39 | 39 | $selectQuery, |
40 | - [$latitude, $longitude, $latitude] |
|
40 | + [ $latitude, $longitude, $latitude ] |
|
41 | 41 | )->orderBy('distance'); |
42 | 42 | } |
43 | 43 | } |
@@ -22,7 +22,7 @@ |
||
22 | 22 | public function definition() |
23 | 23 | { |
24 | 24 | return [ |
25 | - 'name' => 'BCA ' . $this->faker->company, |
|
25 | + 'name' => 'BCA '.$this->faker->company, |
|
26 | 26 | 'address' => $this->faker->address, |
27 | 27 | 'address_latitude' => $latitude = $this->faker->latitude, |
28 | 28 | 'address_longitude' => $longitude = $this->faker->longitude, |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | */ |
48 | 48 | public function unverified() |
49 | 49 | { |
50 | - return $this->state(function (array $attributes) { |
|
50 | + return $this->state(function(array $attributes) { |
|
51 | 51 | return [ |
52 | 52 | 'email_verified_at' => null, |
53 | 53 | ]; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | */ |
62 | 62 | public function unactivate() |
63 | 63 | { |
64 | - return $this->state(function (array $attributes) { |
|
64 | + return $this->state(function(array $attributes) { |
|
65 | 65 | return [ |
66 | 66 | 'is_active' => false, |
67 | 67 | ]; |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | */ |
76 | 76 | public function activate() |
77 | 77 | { |
78 | - return $this->state(function (array $attributes) { |
|
78 | + return $this->state(function(array $attributes) { |
|
79 | 79 | return [ |
80 | 80 | 'is_active' => true, |
81 | 81 | ]; |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | protected static function bootEvent() |
21 | 21 | { |
22 | - static::deleting(function (User $model) { |
|
22 | + static::deleting(function(User $model) { |
|
23 | 23 | $model->roles->map->delete(); |
24 | 24 | }); |
25 | 25 | } |
@@ -43,24 +43,3 @@ |
||
43 | 43 | { |
44 | 44 | if ($this->is_active) { |
45 | 45 | return sprintf(<<<'html' |
46 | - <div class="badge badge-success">%s</div> |
|
47 | - html, trans('Active')); |
|
48 | - } |
|
49 | - |
|
50 | - return sprintf(<<<'html' |
|
51 | - <div class="badge badge-danger">%s</div> |
|
52 | - html, trans('Not Active')); |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * Return "role" attribute value. |
|
57 | - * |
|
58 | - * @return string |
|
59 | - */ |
|
60 | - public function getRoleAttribute(): string |
|
61 | - { |
|
62 | - $this->load('roles:id,name'); |
|
63 | - |
|
64 | - return $this->roles->first()->name; |
|
65 | - } |
|
66 | -} |
@@ -43,24 +43,3 @@ |
||
43 | 43 | { |
44 | 44 | if ($this->is_active) { |
45 | 45 | return sprintf(<<<'html' |
46 | - <div class="badge badge-success">%s</div> |
|
47 | - html, trans('Active')); |
|
48 | - } |
|
49 | - |
|
50 | - return sprintf(<<<'html' |
|
51 | - <div class="badge badge-danger">%s</div> |
|
52 | - html, trans('Not Active')); |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * Return "role" attribute value. |
|
57 | - * |
|
58 | - * @return string |
|
59 | - */ |
|
60 | - public function getRoleAttribute(): string |
|
61 | - { |
|
62 | - $this->load('roles:id,name'); |
|
63 | - |
|
64 | - return $this->roles->first()->name; |
|
65 | - } |
|
66 | -} |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function setPasswordAttribute($value) |
31 | 31 | { |
32 | - $this->attributes['password'] = Hash::make($value); |
|
32 | + $this->attributes[ 'password' ] = Hash::make($value); |
|
33 | 33 | |
34 | 34 | return $this; |
35 | 35 | } |
@@ -43,24 +43,3 @@ discard block |
||
43 | 43 | { |
44 | 44 | if ($this->is_active) { |
45 | 45 | return sprintf(<<<'html' |
46 | - <div class="badge badge-success">%s</div> |
|
47 | - html, trans('Active')); |
|
48 | - } |
|
49 | - |
|
50 | - return sprintf(<<<'html' |
|
51 | - <div class="badge badge-danger">%s</div> |
|
52 | - html, trans('Not Active')); |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * Return "role" attribute value. |
|
57 | - * |
|
58 | - * @return string |
|
59 | - */ |
|
60 | - public function getRoleAttribute(): string |
|
61 | - { |
|
62 | - $this->load('roles:id,name'); |
|
63 | - |
|
64 | - return $this->roles->first()->name; |
|
65 | - } |
|
66 | -} |
@@ -43,24 +43,3 @@ |
||
43 | 43 | { |
44 | 44 | if ($this->is_active) { |
45 | 45 | return sprintf(<<<'html' |
46 | - <div class="badge badge-success">%s</div> |
|
47 | - html, trans('Active')); |
|
48 | - } |
|
49 | - |
|
50 | - return sprintf(<<<'html' |
|
51 | - <div class="badge badge-danger">%s</div> |
|
52 | - html, trans('Not Active')); |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * Return "role" attribute value. |
|
57 | - * |
|
58 | - * @return string |
|
59 | - */ |
|
60 | - public function getRoleAttribute(): string |
|
61 | - { |
|
62 | - $this->load('roles:id,name'); |
|
63 | - |
|
64 | - return $this->roles->first()->name; |
|
65 | - } |
|
66 | -} |
@@ -43,24 +43,3 @@ |
||
43 | 43 | { |
44 | 44 | if ($this->is_active) { |
45 | 45 | return sprintf(<<<'html' |
46 | - <div class="badge badge-success">%s</div> |
|
47 | - html, trans('Active')); |
|
48 | - } |
|
49 | - |
|
50 | - return sprintf(<<<'html' |
|
51 | - <div class="badge badge-danger">%s</div> |
|
52 | - html, trans('Not Active')); |
|
53 | - } |
|
54 | - |
|
55 | - /** |
|
56 | - * Return "role" attribute value. |
|
57 | - * |
|
58 | - * @return string |
|
59 | - */ |
|
60 | - public function getRoleAttribute(): string |
|
61 | - { |
|
62 | - $this->load('roles:id,name'); |
|
63 | - |
|
64 | - return $this->roles->first()->name; |
|
65 | - } |
|
66 | -} |
@@ -34,22 +34,22 @@ discard block |
||
34 | 34 | public function datatable() |
35 | 35 | { |
36 | 36 | return DataTables::eloquent(User::query()->with('branch:id,name')) |
37 | - ->setTransformer(fn ($model) => UserResource::make($model)->resolve()) |
|
38 | - ->orderColumn('branch_name', function ($query, $direction) { |
|
37 | + ->setTransformer(fn($model) => UserResource::make($model)->resolve()) |
|
38 | + ->orderColumn('branch_name', function($query, $direction) { |
|
39 | 39 | $query->join('branches', 'users.branch_id', '=', 'branches.id') |
40 | 40 | ->select('users.*', 'branches.id as branch_id', 'branches.name as branch_name') |
41 | 41 | ->orderBy('branches.name', $direction); |
42 | 42 | }) |
43 | - ->filterColumn('branch_name', function ($query, $keyword) { |
|
44 | - $query->whereHas('branch', function ($query) use ($keyword) { |
|
45 | - $query->where('name', 'like', '%' . $keyword . '%'); |
|
43 | + ->filterColumn('branch_name', function($query, $keyword) { |
|
44 | + $query->whereHas('branch', function($query) use ($keyword) { |
|
45 | + $query->where('name', 'like', '%'.$keyword.'%'); |
|
46 | 46 | }); |
47 | 47 | }) |
48 | - ->filterColumn('is_active', function ($query, $keyword) { |
|
48 | + ->filterColumn('is_active', function($query, $keyword) { |
|
49 | 49 | $active = Str::lower(trans('Active')); |
50 | 50 | $notActive = Str::lower(trans('Not Active')); |
51 | 51 | |
52 | - if (in_array($keyword, [$active, $notActive])) { |
|
52 | + if (in_array($keyword, [ $active, $notActive ])) { |
|
53 | 53 | $query->where('is_active', $keyword === $active); |
54 | 54 | } |
55 | 55 | }) |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | return redirect()->route('admin.user.index')->with([ |
87 | 87 | 'alert' => [ |
88 | 88 | 'type' => 'alert-success', |
89 | - 'message' => trans('The :resource was created!', ['resource' => trans('admin-lang.user')]), |
|
89 | + 'message' => trans('The :resource was created!', [ 'resource' => trans('admin-lang.user') ]), |
|
90 | 90 | ], |
91 | 91 | ]); |
92 | 92 | } |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | return redirect()->route('admin.user.index')->with([ |
122 | 122 | 'alert' => [ |
123 | 123 | 'type' => 'alert-success', |
124 | - 'message' => trans('The :resource was updated!', ['resource' => trans('admin-lang.user')]), |
|
124 | + 'message' => trans('The :resource was updated!', [ 'resource' => trans('admin-lang.user') ]), |
|
125 | 125 | ], |
126 | 126 | ]); |
127 | 127 | } |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | return redirect()->route('admin.user.index')->with([ |
140 | 140 | 'alert' => [ |
141 | 141 | 'type' => 'alert-success', |
142 | - 'message' => trans('The :resource was deleted!', ['resource' => trans('admin-lang.user')]), |
|
142 | + 'message' => trans('The :resource was deleted!', [ 'resource' => trans('admin-lang.user') ]), |
|
143 | 143 | ], |
144 | 144 | ]); |
145 | 145 | } |
@@ -152,12 +152,12 @@ discard block |
||
152 | 152 | */ |
153 | 153 | public function destroyMultiple(Request $request) |
154 | 154 | { |
155 | - User::destroy($request->input('checkbox', [])); |
|
155 | + User::destroy($request->input('checkbox', [ ])); |
|
156 | 156 | |
157 | 157 | return redirect()->route('admin.user.index')->with([ |
158 | 158 | 'alert' => [ |
159 | 159 | 'type' => 'alert-success', |
160 | - 'message' => trans('The :resource was deleted!', ['resource' => trans('admin-lang.user')]), |
|
160 | + 'message' => trans('The :resource was deleted!', [ 'resource' => trans('admin-lang.user') ]), |
|
161 | 161 | ], |
162 | 162 | ]); |
163 | 163 | } |
@@ -20,8 +20,8 @@ |
||
20 | 20 | */ |
21 | 21 | protected static function bootEvent() |
22 | 22 | { |
23 | - static::deleting(function (Customer $model) { |
|
24 | - Storage::delete(Customer::IDENTITYCARD_IMAGE_PATH . '/' . $model->getRawOriginal('identitycard_image')); |
|
23 | + static::deleting(function(Customer $model) { |
|
24 | + Storage::delete(Customer::IDENTITYCARD_IMAGE_PATH.'/'.$model->getRawOriginal('identitycard_image')); |
|
25 | 25 | }); |
26 | 26 | } |
27 | 27 | } |
@@ -26,21 +26,21 @@ |
||
26 | 26 | public function rules() |
27 | 27 | { |
28 | 28 | return [ |
29 | - 'branch_id' => 'required|exists:' . Branch::class . ',id', |
|
30 | - 'username' => 'required|string|max:255|unique:' . User::class, |
|
29 | + 'branch_id' => 'required|exists:'.Branch::class.',id', |
|
30 | + 'username' => 'required|string|max:255|unique:'.User::class, |
|
31 | 31 | 'fullname' => 'required|string|max:255', |
32 | - 'gender' => 'sometimes|nullable|enum:' . Gender::class, |
|
33 | - 'email' => 'required|string|email|max:255|unique:' . User::class, |
|
32 | + 'gender' => 'sometimes|nullable|enum:'.Gender::class, |
|
33 | + 'email' => 'required|string|email|max:255|unique:'.User::class, |
|
34 | 34 | 'phone_country' => 'sometimes|in:ID', |
35 | - 'phone' => ['required', 'string', 'phone:ID', function ($attribute, $phone, $fail) { |
|
35 | + 'phone' => [ 'required', 'string', 'phone:ID', function($attribute, $phone, $fail) { |
|
36 | 36 | $user = User::where($attribute, PhoneNumber::make($phone, request()->input('phone_country', env('PHONE_COUNTRY', 'ID')))->formatE164())->count(); |
37 | 37 | |
38 | 38 | if ($user > 0) { |
39 | - $fail(trans('validation.unique', ['attribute' => static::getAttributes()[$attribute]])); |
|
39 | + $fail(trans('validation.unique', [ 'attribute' => static::getAttributes()[ $attribute ] ])); |
|
40 | 40 | } |
41 | - }], |
|
42 | - 'password' => ['required', 'confirmed', Rules\Password::defaults()], |
|
43 | - 'role' => 'required|exists:' . Role::class . ',name', |
|
41 | + } ], |
|
42 | + 'password' => [ 'required', 'confirmed', Rules\Password::defaults() ], |
|
43 | + 'role' => 'required|exists:'.Role::class.',name', |
|
44 | 44 | 'is_active' => 'required|boolean', |
45 | 45 | ]; |
46 | 46 | } |