@@ -33,25 +33,25 @@ discard block |
||
33 | 33 | public function datatable() |
34 | 34 | { |
35 | 35 | return DataTables::eloquent(Order::query()->with('user:id,fullname')) |
36 | - ->setTransformer(fn ($model) => OrderResource::make($model)->resolve()) |
|
37 | - ->orderColumn('customer_fullname', function ($query, $direction) { |
|
36 | + ->setTransformer(fn($model) => OrderResource::make($model)->resolve()) |
|
37 | + ->orderColumn('customer_fullname', function($query, $direction) { |
|
38 | 38 | $query->join('customers', 'orders.customer_id', '=', 'customers.id') |
39 | 39 | ->select('orders.*', 'customers.id as customer_id', 'customers.fullname as customer_fullname') |
40 | 40 | ->orderBy('customers.fullname', $direction); |
41 | 41 | }) |
42 | - ->filterColumn('customer_fullname', function ($query, $keyword) { |
|
43 | - $query->whereHas('customer', function ($query) use ($keyword) { |
|
44 | - $query->where('fullname', 'like', '%' . $keyword . '%'); |
|
42 | + ->filterColumn('customer_fullname', function($query, $keyword) { |
|
43 | + $query->whereHas('customer', function($query) use ($keyword) { |
|
44 | + $query->where('fullname', 'like', '%'.$keyword.'%'); |
|
45 | 45 | }); |
46 | 46 | }) |
47 | - ->orderColumn('status', function ($query, $direction) { |
|
47 | + ->orderColumn('status', function($query, $direction) { |
|
48 | 48 | $query->join('order_statuses', 'order_statuses.order_id', '=', 'orders.id') |
49 | 49 | ->select('orders.*', 'order_statuses.id as order_status_id', 'order_statuses.status as order_status') |
50 | 50 | ->orderBy('order_statuses.status', $direction); |
51 | 51 | }) |
52 | - ->filterColumn('status', function ($query, $keyword) { |
|
53 | - $query->whereHas('latestStatus', function ($query) use ($keyword) { |
|
54 | - $query->where('status', 'like', '%' . $keyword . '%'); |
|
52 | + ->filterColumn('status', function($query, $keyword) { |
|
53 | + $query->whereHas('latestStatus', function($query) use ($keyword) { |
|
54 | + $query->where('status', 'like', '%'.$keyword.'%'); |
|
55 | 55 | }); |
56 | 56 | }) |
57 | 57 | ->toJson(); |
@@ -89,17 +89,17 @@ discard block |
||
89 | 89 | $alert = [ |
90 | 90 | 'alert' => [ |
91 | 91 | 'type' => 'alert-success', |
92 | - 'message' => trans('The :resource was created!', ['resource' => trans('admin-lang.user')]), |
|
92 | + 'message' => trans('The :resource was created!', [ 'resource' => trans('admin-lang.user') ]), |
|
93 | 93 | ], |
94 | 94 | ]; |
95 | 95 | |
96 | 96 | try { |
97 | - DB::transaction(function () use ($request) { |
|
97 | + DB::transaction(function() use ($request) { |
|
98 | 98 | $order = $request->getOrder(); |
99 | 99 | |
100 | 100 | $order->setCustomerRelationValue($request->getCustomer()); |
101 | - transform($request->getUser(), fn (User $user) => $order->setUserRelationValue($user)); |
|
102 | - transform($request->getBranch(), fn (Branch $branch) => $order->setBranchRelationValue($branch)); |
|
101 | + transform($request->getUser(), fn(User $user) => $order->setUserRelationValue($user)); |
|
102 | + transform($request->getBranch(), fn(Branch $branch) => $order->setBranchRelationValue($branch)); |
|
103 | 103 | |
104 | 104 | $order->save(); |
105 | 105 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | return redirect()->route('admin.order.index')->with([ |
146 | 146 | 'alert' => [ |
147 | 147 | 'type' => 'alert-success', |
148 | - 'message' => trans('The :resource was updated!', ['resource' => trans('admin-lang.order')]), |
|
148 | + 'message' => trans('The :resource was updated!', [ 'resource' => trans('admin-lang.order') ]), |
|
149 | 149 | ], |
150 | 150 | ]); |
151 | 151 | } |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | return redirect()->route('admin.order.index')->with([ |
164 | 164 | 'alert' => [ |
165 | 165 | 'type' => 'alert-success', |
166 | - 'message' => trans('The :resource was deleted!', ['resource' => trans('admin-lang.order')]), |
|
166 | + 'message' => trans('The :resource was deleted!', [ 'resource' => trans('admin-lang.order') ]), |
|
167 | 167 | ], |
168 | 168 | ]); |
169 | 169 | } |
@@ -176,12 +176,12 @@ discard block |
||
176 | 176 | */ |
177 | 177 | public function destroyMultiple(Request $request) |
178 | 178 | { |
179 | - Order::destroy($request->input('checkbox', [])); |
|
179 | + Order::destroy($request->input('checkbox', [ ])); |
|
180 | 180 | |
181 | 181 | return redirect()->route('admin.order.index')->with([ |
182 | 182 | 'alert' => [ |
183 | 183 | 'type' => 'alert-success', |
184 | - 'message' => trans('The :resource was deleted!', ['resource' => trans('admin-lang.order')]), |
|
184 | + 'message' => trans('The :resource was deleted!', [ 'resource' => trans('admin-lang.order') ]), |
|
185 | 185 | ], |
186 | 186 | ]); |
187 | 187 | } |
@@ -74,12 +74,12 @@ discard block |
||
74 | 74 | Button::create(view('conversations.register-customer.reply-customer_data-no')->render())->value('no'), |
75 | 75 | ]); |
76 | 76 | |
77 | - return $this->ask($question, next: function (Answer $answer) use ($customer) { |
|
77 | + return $this->ask($question, next: function(Answer $answer) use ($customer) { |
|
78 | 78 | if (!$answer->isInteractiveMessageReply()) { |
79 | 79 | return; |
80 | 80 | } |
81 | 81 | |
82 | - if (!in_array($value = $answer->getValue(), ['yes', 'no'])) { |
|
82 | + if (!in_array($value = $answer->getValue(), [ 'yes', 'no' ])) { |
|
83 | 83 | return $this->displayCustomerData($customer, $this->fallbackMessage($answer->getText())); |
84 | 84 | } |
85 | 85 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $additionalParameters = $keyboard->toArray() |
123 | 123 | ); |
124 | 124 | |
125 | - return $this->getBot()->storeConversation($this, next: function (Answer $answer) use ($response, $customer, $denominations) { |
|
125 | + return $this->getBot()->storeConversation($this, next: function(Answer $answer) use ($response, $customer, $denominations) { |
|
126 | 126 | if (!$answer->isInteractiveMessageReply()) { |
127 | 127 | return; |
128 | 128 | } |
@@ -134,8 +134,8 @@ discard block |
||
134 | 134 | } |
135 | 135 | |
136 | 136 | /** @var \App\Models\Order $order */ |
137 | - $order = Order::findOrCreateFromCode($this->getUserStorage('order_code'), $customer, function (Order $order) { |
|
138 | - $this->setUserStorage(['order_code' => $order->code]); |
|
137 | + $order = Order::findOrCreateFromCode($this->getUserStorage('order_code'), $customer, function(Order $order) { |
|
138 | + $this->setUserStorage([ 'order_code' => $order->code ]); |
|
139 | 139 | }); |
140 | 140 | |
141 | 141 | $this->recordItem($customer, $order, $denomination); |
@@ -160,15 +160,15 @@ discard block |
||
160 | 160 | $keyboard = Keyboard::create(Keyboard::TYPE_INLINE)->resizeKeyboard(); |
161 | 161 | $unit = Str::lower($denomination->type->label); |
162 | 162 | |
163 | - collect($denomination->range_order_bundle)->chunk(3)->map(function (Collection $quantities) use ($keyboard, $unit) { |
|
164 | - $keyboard->addRow(...$quantities->map(fn ($quantity) => KeyboardButton::create( |
|
163 | + collect($denomination->range_order_bundle)->chunk(3)->map(function(Collection $quantities) use ($keyboard, $unit) { |
|
164 | + $keyboard->addRow(...$quantities->map(fn($quantity) => KeyboardButton::create( |
|
165 | 165 | view('conversations.exchange.reply-bundle_quantity-quantity', compact('quantity'))->render() |
166 | 166 | )->callbackData($quantity))->toArray()); |
167 | 167 | }); |
168 | 168 | |
169 | 169 | $keyboard->addRow( |
170 | 170 | KeyboardButton::create( |
171 | - view('components.conversations.back', ['text' => 'opsi pilih nominal uang'])->render() |
|
171 | + view('components.conversations.back', [ 'text' => 'opsi pilih nominal uang' ])->render() |
|
172 | 172 | )->callbackData('back_to_denomination_option') |
173 | 173 | ); |
174 | 174 | |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | $additionalParameters = $keyboard->toArray() |
178 | 178 | ); |
179 | 179 | |
180 | - return $this->getBot()->storeConversation($this, next: function (Answer $answer) use ($response, $customer, $order, $denomination) { |
|
180 | + return $this->getBot()->storeConversation($this, next: function(Answer $answer) use ($response, $customer, $order, $denomination) { |
|
181 | 181 | $this->deleteTelegramMessageFromResponse($response); |
182 | 182 | |
183 | 183 | if ($answer->getValue() === 'back_to_denomination_option') { |
@@ -17,7 +17,7 @@ |
||
17 | 17 | */ |
18 | 18 | public function up() |
19 | 19 | { |
20 | - Schema::create('customers', function (Blueprint $table) { |
|
20 | + Schema::create('customers', function(Blueprint $table) { |
|
21 | 21 | $table->id(); |
22 | 22 | |
23 | 23 | $table->string('telegram_chat_id')->unique(); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | { |
25 | 25 | return [ |
26 | 26 | 'status' => EnumOrderStatus::from($this->faker->randomElement(EnumOrderStatus::toValues())), |
27 | - 'note' => $this->faker->randomElement([null, $this->faker->text]), |
|
27 | + 'note' => $this->faker->randomElement([ null, $this->faker->text ]), |
|
28 | 28 | ]; |
29 | 29 | } |
30 | 30 |
@@ -26,7 +26,7 @@ |
||
26 | 26 | |
27 | 27 | return [ |
28 | 28 | 'denomination_id' => $denomination, |
29 | - 'bundle_quantity' => $denomination->range_order_bundle[array_rand($denomination->range_order_bundle)], |
|
29 | + 'bundle_quantity' => $denomination->range_order_bundle[ array_rand($denomination->range_order_bundle) ], |
|
30 | 30 | ]; |
31 | 31 | } |
32 | 32 | } |
@@ -23,45 +23,45 @@ discard block |
||
23 | 23 | |
24 | 24 | Route::view('/', 'welcome'); |
25 | 25 | |
26 | -Route::middleware('auth:web', 'verified', 'user_is_active')->name('admin.')->group(function () { |
|
26 | +Route::middleware('auth:web', 'verified', 'user_is_active')->name('admin.')->group(function() { |
|
27 | 27 | Route::get('/dashboard', DashboardController::class)->name('dashboard'); |
28 | 28 | |
29 | - Route::prefix('/order')->name('order.')->group(function () { |
|
30 | - Route::post('/datatable', [OrderController::class, 'datatable'])->name('datatable'); |
|
31 | - Route::post('/{order}/datatable-row-child', [OrderController::class, 'datatableRowChild'])->name('datatable-row-child'); |
|
32 | - Route::delete('/multiple', [OrderController::class, 'destroyMultiple'])->name('destroy-multiple'); |
|
29 | + Route::prefix('/order')->name('order.')->group(function() { |
|
30 | + Route::post('/datatable', [ OrderController::class, 'datatable' ])->name('datatable'); |
|
31 | + Route::post('/{order}/datatable-row-child', [ OrderController::class, 'datatableRowChild' ])->name('datatable-row-child'); |
|
32 | + Route::delete('/multiple', [ OrderController::class, 'destroyMultiple' ])->name('destroy-multiple'); |
|
33 | 33 | }); |
34 | 34 | |
35 | - Route::prefix('/user')->name('user.')->group(function () { |
|
36 | - Route::post('/datatable', [UserController::class, 'datatable'])->name('datatable'); |
|
37 | - Route::delete('/multiple', [UserController::class, 'destroyMultiple'])->name('destroy-multiple'); |
|
35 | + Route::prefix('/user')->name('user.')->group(function() { |
|
36 | + Route::post('/datatable', [ UserController::class, 'datatable' ])->name('datatable'); |
|
37 | + Route::delete('/multiple', [ UserController::class, 'destroyMultiple' ])->name('destroy-multiple'); |
|
38 | 38 | }); |
39 | 39 | |
40 | - Route::prefix('/branch')->name('branch.')->group(function () { |
|
41 | - Route::post('/datatable', [BranchController::class, 'datatable'])->name('datatable'); |
|
42 | - Route::delete('/multiple', [BranchController::class, 'destroyMultiple'])->name('destroy-multiple'); |
|
40 | + Route::prefix('/branch')->name('branch.')->group(function() { |
|
41 | + Route::post('/datatable', [ BranchController::class, 'datatable' ])->name('datatable'); |
|
42 | + Route::delete('/multiple', [ BranchController::class, 'destroyMultiple' ])->name('destroy-multiple'); |
|
43 | 43 | }); |
44 | 44 | |
45 | - Route::prefix('/customer')->name('customer.')->group(function () { |
|
46 | - Route::post('/datatable', [CustomerController::class, 'datatable'])->name('datatable'); |
|
47 | - Route::delete('/multiple', [CustomerController::class, 'destroyMultiple'])->name('destroy-multiple'); |
|
48 | - Route::delete('/{customer}/identitycard_image', [CustomerController::class, 'destroyIdentitycardImage'])->name('destroy-identitycard_image'); |
|
45 | + Route::prefix('/customer')->name('customer.')->group(function() { |
|
46 | + Route::post('/datatable', [ CustomerController::class, 'datatable' ])->name('datatable'); |
|
47 | + Route::delete('/multiple', [ CustomerController::class, 'destroyMultiple' ])->name('destroy-multiple'); |
|
48 | + Route::delete('/{customer}/identitycard_image', [ CustomerController::class, 'destroyIdentitycardImage' ])->name('destroy-identitycard_image'); |
|
49 | 49 | }); |
50 | 50 | |
51 | - Route::prefix('/denomination')->name('denomination.')->group(function () { |
|
52 | - Route::post('/datatable', [DenominationController::class, 'datatable'])->name('datatable'); |
|
53 | - Route::delete('/multiple', [DenominationController::class, 'destroyMultiple'])->name('destroy-multiple'); |
|
54 | - Route::delete('/{denomination}/image', [DenominationController::class, 'destroyImage'])->name('destroy-image'); |
|
51 | + Route::prefix('/denomination')->name('denomination.')->group(function() { |
|
52 | + Route::post('/datatable', [ DenominationController::class, 'datatable' ])->name('datatable'); |
|
53 | + Route::delete('/multiple', [ DenominationController::class, 'destroyMultiple' ])->name('destroy-multiple'); |
|
54 | + Route::delete('/{denomination}/image', [ DenominationController::class, 'destroyImage' ])->name('destroy-image'); |
|
55 | 55 | }); |
56 | 56 | |
57 | - Route::prefix('/role')->name('role.')->middleware('role:admin')->group(function () { |
|
58 | - Route::post('/datatable', [RoleController::class, 'datatable'])->name('datatable'); |
|
59 | - Route::delete('/multiple', [RoleController::class, 'destroyMultiple'])->name('destroy-multiple'); |
|
57 | + Route::prefix('/role')->name('role.')->middleware('role:admin')->group(function() { |
|
58 | + Route::post('/datatable', [ RoleController::class, 'datatable' ])->name('datatable'); |
|
59 | + Route::delete('/multiple', [ RoleController::class, 'destroyMultiple' ])->name('destroy-multiple'); |
|
60 | 60 | }); |
61 | 61 | |
62 | - Route::prefix('/configuration')->name('configuration.')->group(function () { |
|
63 | - Route::post('/datatable', [ConfigurationController::class, 'datatable'])->name('datatable'); |
|
64 | - Route::delete('/multiple', [ConfigurationController::class, 'destroyMultiple'])->middleware('role:admin')->name('destroy-multiple'); |
|
62 | + Route::prefix('/configuration')->name('configuration.')->group(function() { |
|
63 | + Route::post('/datatable', [ ConfigurationController::class, 'datatable' ])->name('datatable'); |
|
64 | + Route::delete('/multiple', [ ConfigurationController::class, 'destroyMultiple' ])->middleware('role:admin')->name('destroy-multiple'); |
|
65 | 65 | }); |
66 | 66 | |
67 | 67 | Route::resource('/order', OrderController::class)->except('show'); |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | Route::resource('/branch', BranchController::class)->except('show'); |
70 | 70 | Route::resource('/customer', CustomerController::class)->except('show'); |
71 | 71 | Route::resource('/denomination', DenominationController::class)->except('show'); |
72 | - Route::resource('/role', RoleController::class, ['middleware' => 'role:admin'])->except('show'); |
|
72 | + Route::resource('/role', RoleController::class, [ 'middleware' => 'role:admin' ])->except('show'); |
|
73 | 73 | Route::resource('/configuration', ConfigurationController::class)->except('show'); |
74 | 74 | }); |
75 | 75 |