@@ -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 | $table->nullableMorphs('issuerable'); |
23 | 23 |
@@ -31,7 +31,7 @@ |
||
31 | 31 | */ |
32 | 32 | public function getTelegramChatId(): array |
33 | 33 | { |
34 | - return User::getAdmin(['id', 'telegram_chat_id'])->pluck('telegram_chat_id')->toArray(); |
|
34 | + return User::getAdmin([ 'id', 'telegram_chat_id' ])->pluck('telegram_chat_id')->toArray(); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -25,7 +25,7 @@ discard block |
||
25 | 25 | $keyboard = Keyboard::create(Keyboard::TYPE_INLINE)->resizeKeyboard(); |
26 | 26 | |
27 | 27 | foreach (static::conversations(withoutStartCommand: true) as $conversation) { |
28 | - $commands = Arr::wrap($conversation['command']); |
|
28 | + $commands = Arr::wrap($conversation[ 'command' ]); |
|
29 | 29 | |
30 | 30 | $keyboard->addRow(KeyboardButton::create(Arr::last($commands)) |
31 | 31 | ->callbackData(Arr::first($commands)) |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | $additionalParameters = $keyboard->toArray() |
38 | 38 | ); |
39 | 39 | |
40 | - return $this->getBot()->storeConversation($this, next: function (Answer $answer) use ($response) { |
|
40 | + return $this->getBot()->storeConversation($this, next: function(Answer $answer) use ($response) { |
|
41 | 41 | if (!$answer->isInteractiveMessageReply()) { |
42 | 42 | return; |
43 | 43 | } |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | */ |
61 | 61 | protected function getConversation(string $name): ?Conversation |
62 | 62 | { |
63 | - if (!$conversation = static::conversations(withoutStartCommand: true)->first(fn ($conversation) => |
|
64 | - in_array($name, Arr::wrap($conversation['command'])) |
|
63 | + if (!$conversation = static::conversations(withoutStartCommand: true)->first(fn($conversation) => |
|
64 | + in_array($name, Arr::wrap($conversation[ 'command' ])) |
|
65 | 65 | )) { |
66 | 66 | return null; |
67 | 67 | } |
68 | 68 | |
69 | - return value($conversation['handler']); |
|
69 | + return value($conversation[ 'handler' ]); |
|
70 | 70 | } |
71 | 71 | |
72 | 72 | /** |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | $conversations = collect([ |
83 | 83 | [ |
84 | 84 | 'command' => 'start', |
85 | - 'handler' => fn () => new StartConservation, |
|
85 | + 'handler' => fn() => new StartConservation, |
|
86 | 86 | 'description' => 'Memulai percakapan', |
87 | 87 | ], |
88 | 88 | [ |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | 'exchange', |
91 | 91 | view('conversations.home.reply-menu-exchange')->render(), |
92 | 92 | ], |
93 | - 'handler' => fn () => new ExchangeConversation, |
|
93 | + 'handler' => fn() => new ExchangeConversation, |
|
94 | 94 | 'description' => 'Melakukan transaksi penukaran uang', |
95 | 95 | ], |
96 | 96 | [ |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | 'help', |
99 | 99 | view('conversations.home.reply-menu-help')->render(), |
100 | 100 | ], |
101 | - 'handler' => fn () => new HelpConversation, |
|
101 | + 'handler' => fn() => new HelpConversation, |
|
102 | 102 | 'description' => 'Panduan cara menggunakan chatbot ini', |
103 | 103 | ], |
104 | 104 | [ |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | 'login', |
107 | 107 | view('conversations.home.reply-menu-login')->render(), |
108 | 108 | ], |
109 | - 'handler' => fn () => new LoginConversation, |
|
109 | + 'handler' => fn() => new LoginConversation, |
|
110 | 110 | 'description' => 'Mendaftarkan Chat ID Telegram pada akun (khusus admin dan staf)', |
111 | 111 | 'is_hidden' => true, |
112 | 112 | ], |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | 'logout', |
116 | 116 | view('conversations.home.reply-menu-logout')->render(), |
117 | 117 | ], |
118 | - 'handler' => fn () => new LogoutConversation, |
|
118 | + 'handler' => fn() => new LogoutConversation, |
|
119 | 119 | 'description' => 'Menghapus Chat ID Telegram pada akun (khusus admin dan staf)', |
120 | 120 | 'is_hidden' => true, |
121 | 121 | ], |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | 'ask_telegram_chat_id', |
125 | 125 | view('conversations.home.reply-menu-ask_telegram_chat_id')->render(), |
126 | 126 | ], |
127 | - 'handler' => fn () => new AskTelegramChatIdConversation, |
|
127 | + 'handler' => fn() => new AskTelegramChatIdConversation, |
|
128 | 128 | 'description' => 'Mengetahui Chat ID Telegram anda', |
129 | 129 | 'is_hidden' => true, |
130 | 130 | ], |
@@ -133,21 +133,21 @@ discard block |
||
133 | 133 | 'check_order_status', |
134 | 134 | view('conversations.home.reply-menu-check_order_status')->render(), |
135 | 135 | ], |
136 | - 'handler' => fn () => new CheckOrderStatusConversation, |
|
136 | + 'handler' => fn() => new CheckOrderStatusConversation, |
|
137 | 137 | 'description' => 'Mengetahui status transaksi penukaran uang anda', |
138 | 138 | 'is_hidden' => true, |
139 | 139 | ], |
140 | 140 | ]); |
141 | 141 | |
142 | 142 | if ($withoutStartCommand) { |
143 | - $conversations = $conversations->reject(fn (array $conversation) => |
|
144 | - in_array('start', Arr::wrap($conversation['command'])) |
|
143 | + $conversations = $conversations->reject(fn(array $conversation) => |
|
144 | + in_array('start', Arr::wrap($conversation[ 'command' ])) |
|
145 | 145 | ); |
146 | 146 | } |
147 | 147 | |
148 | 148 | if (!$withHidden) { |
149 | - $conversations = $conversations->reject(fn (array $conversation) => |
|
150 | - ($conversation['is_hidden'] ?? false) |
|
149 | + $conversations = $conversations->reject(fn(array $conversation) => |
|
150 | + ($conversation[ 'is_hidden' ] ?? false) |
|
151 | 151 | ); |
152 | 152 | } |
153 | 153 |
@@ -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('view', $this->resource)) { |
23 | - $elements[] = view('components.datatables.link-show', [ |
|
23 | + $elements[ ] = view('components.datatables.link-show', [ |
|
24 | 24 | 'url' => route('admin.order.show', $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.order.destroy', $this->resource), |
31 | 31 | ])->render(); |
32 | 32 | } |
@@ -40,8 +40,8 @@ discard block |
||
40 | 40 | public function rules() |
41 | 41 | { |
42 | 42 | return [ |
43 | - 'start_date' => 'required|date_format:Y-m-d|after_or_equal:' . Carbon::today()->startOfMonth()->format('Y-m-d'), |
|
44 | - 'end_date' => 'required|date_format:Y-m-d|before_or_equal:' . Carbon::today()->endOfMonth()->format('Y-m-d'), |
|
43 | + 'start_date' => 'required|date_format:Y-m-d|after_or_equal:'.Carbon::today()->startOfMonth()->format('Y-m-d'), |
|
44 | + 'end_date' => 'required|date_format:Y-m-d|before_or_equal:'.Carbon::today()->endOfMonth()->format('Y-m-d'), |
|
45 | 45 | ]; |
46 | 46 | } |
47 | 47 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | */ |
54 | 54 | protected function parseDaterange(string $value): array |
55 | 55 | { |
56 | - return tap(array_pad(explode(' - ', $value), 2, null), function (array $daterange) { |
|
57 | - $this->start_date = Carbon::parse($daterange[0]); |
|
58 | - $this->end_date = Carbon::parse($daterange[1]); |
|
56 | + return tap(array_pad(explode(' - ', $value), 2, null), function(array $daterange) { |
|
57 | + $this->start_date = Carbon::parse($daterange[ 0 ]); |
|
58 | + $this->end_date = Carbon::parse($daterange[ 1 ]); |
|
59 | 59 | }); |
60 | 60 | } |
61 | 61 | } |
@@ -13,8 +13,8 @@ |
||
13 | 13 | public function rules() |
14 | 14 | { |
15 | 15 | return [ |
16 | - 'branch_id' => 'sometimes|nullable|exists:' . Branch::class . ',id', |
|
17 | - 'user_id' => 'sometimes|nullable|exists:' . User::class . ',id', |
|
16 | + 'branch_id' => 'sometimes|nullable|exists:'.Branch::class.',id', |
|
17 | + 'user_id' => 'sometimes|nullable|exists:'.User::class.',id', |
|
18 | 18 | 'schedule_date' => 'sometimes|nullable|after_or_equal:today', |
19 | 19 | 'order_status.note' => 'sometimes|nullable|string|max:255', |
20 | 20 | ]; |
@@ -47,25 +47,25 @@ discard block |
||
47 | 47 | $this->authorize('viewAny', Order::class); |
48 | 48 | |
49 | 49 | return DataTables::eloquent(Order::query()->with('user:id,fullname')) |
50 | - ->setTransformer(fn ($model) => OrderResource::make($model)->resolve()) |
|
51 | - ->orderColumn('customer_fullname', function ($query, $direction) { |
|
50 | + ->setTransformer(fn($model) => OrderResource::make($model)->resolve()) |
|
51 | + ->orderColumn('customer_fullname', function($query, $direction) { |
|
52 | 52 | $query->join('customers', 'orders.customer_id', '=', 'customers.id') |
53 | 53 | ->select('orders.*', 'customers.id as customer_id', 'customers.fullname as customer_fullname') |
54 | 54 | ->orderBy('customers.fullname', $direction); |
55 | 55 | }) |
56 | - ->filterColumn('customer_fullname', function ($query, $keyword) { |
|
57 | - $query->whereHas('customer', function ($query) use ($keyword) { |
|
58 | - $query->where('fullname', 'like', '%' . $keyword . '%'); |
|
56 | + ->filterColumn('customer_fullname', function($query, $keyword) { |
|
57 | + $query->whereHas('customer', function($query) use ($keyword) { |
|
58 | + $query->where('fullname', 'like', '%'.$keyword.'%'); |
|
59 | 59 | }); |
60 | 60 | }) |
61 | - ->orderColumn('status', function ($query, $direction) { |
|
61 | + ->orderColumn('status', function($query, $direction) { |
|
62 | 62 | $query->join('order_statuses', 'order_statuses.order_id', '=', 'orders.id') |
63 | 63 | ->select('orders.*', 'order_statuses.id as order_status_id', 'order_statuses.status as order_status') |
64 | 64 | ->orderBy('order_statuses.status', $direction); |
65 | 65 | }) |
66 | - ->filterColumn('status', function ($query, $keyword) { |
|
67 | - $query->whereHas('latestStatus', function ($query) use ($keyword) { |
|
68 | - $query->where('status', 'like', '%' . $keyword . '%'); |
|
66 | + ->filterColumn('status', function($query, $keyword) { |
|
67 | + $query->whereHas('latestStatus', function($query) use ($keyword) { |
|
68 | + $query->where('status', 'like', '%'.$keyword.'%'); |
|
69 | 69 | }); |
70 | 70 | }) |
71 | 71 | ->toJson(); |
@@ -97,17 +97,17 @@ discard block |
||
97 | 97 | $alert = [ |
98 | 98 | 'alert' => [ |
99 | 99 | 'type' => 'alert-success', |
100 | - 'message' => trans('The :resource was created!', ['resource' => trans('admin-lang.order')]), |
|
100 | + 'message' => trans('The :resource was created!', [ 'resource' => trans('admin-lang.order') ]), |
|
101 | 101 | ], |
102 | 102 | ]; |
103 | 103 | |
104 | 104 | try { |
105 | - $order = DB::transaction(function () use ($request) { |
|
105 | + $order = DB::transaction(function() use ($request) { |
|
106 | 106 | $order = $request->getOrder(); |
107 | 107 | |
108 | 108 | $order->setCustomerRelationValue($request->getCustomer()); |
109 | - transform($request->getUser(), fn (User $user) => $order->setUserRelationValue($user)); |
|
110 | - transform($request->getBranch(), fn (Branch $branch) => $order->setBranchRelationValue($branch)); |
|
109 | + transform($request->getUser(), fn(User $user) => $order->setUserRelationValue($user)); |
|
110 | + transform($request->getBranch(), fn(Branch $branch) => $order->setBranchRelationValue($branch)); |
|
111 | 111 | |
112 | 112 | $order->save(); |
113 | 113 | |
@@ -140,8 +140,8 @@ discard block |
||
140 | 140 | public function show(Order $order) |
141 | 141 | { |
142 | 142 | $order->load([ |
143 | - 'statuses' => fn (Relation $query) => $query->latest(), |
|
144 | - 'items' => fn (Relation $query) => $query->with('denomination'), |
|
143 | + 'statuses' => fn(Relation $query) => $query->latest(), |
|
144 | + 'items' => fn(Relation $query) => $query->with('denomination'), |
|
145 | 145 | ]); |
146 | 146 | |
147 | 147 | return view('admin.order.show', compact('order')); |
@@ -155,12 +155,12 @@ discard block |
||
155 | 155 | */ |
156 | 156 | public function destroy(Order $order) |
157 | 157 | { |
158 | - DB::transaction(fn () => $order->delete()); |
|
158 | + DB::transaction(fn() => $order->delete()); |
|
159 | 159 | |
160 | 160 | return redirect()->route('admin.order.index')->with([ |
161 | 161 | 'alert' => [ |
162 | 162 | 'type' => 'alert-success', |
163 | - 'message' => trans('The :resource was deleted!', ['resource' => trans('admin-lang.order')]), |
|
163 | + 'message' => trans('The :resource was deleted!', [ 'resource' => trans('admin-lang.order') ]), |
|
164 | 164 | ], |
165 | 165 | ]); |
166 | 166 | } |
@@ -173,8 +173,8 @@ discard block |
||
173 | 173 | */ |
174 | 174 | public function destroyMultiple(Request $request) |
175 | 175 | { |
176 | - DB::transaction(function () use ($request) { |
|
177 | - foreach ($request->input('checkbox', []) as $id) { |
|
176 | + DB::transaction(function() use ($request) { |
|
177 | + foreach ($request->input('checkbox', [ ]) as $id) { |
|
178 | 178 | $order = Order::find($id, 'id'); |
179 | 179 | |
180 | 180 | $this->authorize('delete', $order); |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | return redirect()->route('admin.order.index')->with([ |
187 | 187 | 'alert' => [ |
188 | 188 | 'type' => 'alert-success', |
189 | - 'message' => trans('The :resource was deleted!', ['resource' => trans('admin-lang.order')]), |
|
189 | + 'message' => trans('The :resource was deleted!', [ 'resource' => trans('admin-lang.order') ]), |
|
190 | 190 | ], |
191 | 191 | ]); |
192 | 192 | } |
@@ -37,28 +37,28 @@ discard block |
||
37 | 37 | |
38 | 38 | $query = Order::query()->with('user:id,fullname') |
39 | 39 | ->has('items') |
40 | - ->whereBetween('created_at', [$request->start_date, $request->end_date]); |
|
40 | + ->whereBetween('created_at', [ $request->start_date, $request->end_date ]); |
|
41 | 41 | |
42 | 42 | return DataTables::eloquent($query) |
43 | - ->setTransformer(fn ($model) => OrderResource::make($model)->resolve()) |
|
44 | - ->orderColumn('customer_fullname', function ($query, $direction) { |
|
43 | + ->setTransformer(fn($model) => OrderResource::make($model)->resolve()) |
|
44 | + ->orderColumn('customer_fullname', function($query, $direction) { |
|
45 | 45 | $query->join('customers', 'orders.customer_id', '=', 'customers.id') |
46 | 46 | ->select('orders.*', 'customers.id as customer_id', 'customers.fullname as customer_fullname') |
47 | 47 | ->orderBy('customers.fullname', $direction); |
48 | 48 | }) |
49 | - ->filterColumn('customer_fullname', function ($query, $keyword) { |
|
50 | - $query->whereHas('customer', function ($query) use ($keyword) { |
|
51 | - $query->where('fullname', 'like', '%' . $keyword . '%'); |
|
49 | + ->filterColumn('customer_fullname', function($query, $keyword) { |
|
50 | + $query->whereHas('customer', function($query) use ($keyword) { |
|
51 | + $query->where('fullname', 'like', '%'.$keyword.'%'); |
|
52 | 52 | }); |
53 | 53 | }) |
54 | - ->orderColumn('status', function ($query, $direction) { |
|
54 | + ->orderColumn('status', function($query, $direction) { |
|
55 | 55 | $query->join('order_statuses', 'order_statuses.order_id', '=', 'orders.id') |
56 | 56 | ->select('orders.*', 'order_statuses.id as order_status_id', 'order_statuses.status as order_status') |
57 | 57 | ->orderBy('order_statuses.status', $direction); |
58 | 58 | }) |
59 | - ->filterColumn('status', function ($query, $keyword) { |
|
60 | - $query->whereHas('latestStatus', function ($query) use ($keyword) { |
|
61 | - $query->where('status', 'like', '%' . $keyword . '%'); |
|
59 | + ->filterColumn('status', function($query, $keyword) { |
|
60 | + $query->whereHas('latestStatus', function($query) use ($keyword) { |
|
61 | + $query->where('status', 'like', '%'.$keyword.'%'); |
|
62 | 62 | }); |
63 | 63 | }) |
64 | 64 | ->toJson(); |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | { |
75 | 75 | $query = Item::query() |
76 | 76 | ->with('order.user', 'order.customer', 'denomination') |
77 | - ->whereHas('order', function (Builder $query) use ($request) { |
|
78 | - $query->whereBetween('created_at', [$request->start_date, $request->end_date]); |
|
77 | + ->whereHas('order', function(Builder $query) use ($request) { |
|
78 | + $query->whereBetween('created_at', [ $request->start_date, $request->end_date ]); |
|
79 | 79 | }); |
80 | 80 | |
81 | 81 | return new OrderExport($query); |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | */ |
65 | 65 | public function __construct(protected Builder $query) |
66 | 66 | { |
67 | - $this->fileName = 'Order Report - ' . Carbon::today()->format('Y-m-d') . '.' . Str::lower(Excel::XLSX); |
|
67 | + $this->fileName = 'Order Report - '.Carbon::today()->format('Y-m-d').'.'.Str::lower(Excel::XLSX); |
|
68 | 68 | } |
69 | 69 | |
70 | 70 | /** |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | */ |
91 | 91 | public function bindValue(Cell $cell, $value): bool |
92 | 92 | { |
93 | - if (($this->columnFormats()[$cell->getColumn()] ?? null) === NumberFormat::FORMAT_TEXT) { |
|
93 | + if (($this->columnFormats()[ $cell->getColumn() ] ?? null) === NumberFormat::FORMAT_TEXT) { |
|
94 | 94 | $cell->setValueExplicit($value, DataType::TYPE_STRING); |
95 | 95 | |
96 | 96 | return true; |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | public function registerEvents(): array |
106 | 106 | { |
107 | 107 | return [ |
108 | - AfterSheet::class => function (AfterSheet $event) { |
|
108 | + AfterSheet::class => function(AfterSheet $event) { |
|
109 | 109 | $this->mergeCell($event); |
110 | 110 | }, |
111 | 111 | ]; |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $grandTotalIndex = array_search('Grand Total', $this->headings()) + 1; |
123 | 123 | $tellerIndex = array_search('Teller', $this->headings()) + 1; |
124 | 124 | |
125 | - $mergeRows = []; |
|
125 | + $mergeRows = [ ]; |
|
126 | 126 | $currentMergeRowStart = 2; |
127 | 127 | |
128 | 128 | for ($row = $currentMergeRowStart; $row <= ($this->totalRow + 1); $row++) { |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | continue; |
135 | 135 | } |
136 | 136 | |
137 | - $mergeRows[$currentMergeRowStart] = $row; |
|
137 | + $mergeRows[ $currentMergeRowStart ] = $row; |
|
138 | 138 | } |
139 | 139 | |
140 | 140 | foreach ($mergeRows as $rowStart => $rowUntil) { |
@@ -180,7 +180,7 @@ discard block |
||
180 | 180 | /** @var \App\Models\Item|null */ |
181 | 181 | $lastItem = null; |
182 | 182 | |
183 | - return $this->query->get()->map(function (Item $item, $index) use (&$lastItem) { |
|
183 | + return $this->query->get()->map(function(Item $item, $index) use (&$lastItem) { |
|
184 | 184 | $this->totalRow += 1; |
185 | 185 | |
186 | 186 | $showOrderTotal = is_null($lastItem) || !$item->order->is($lastItem->order); |