@@ -18,23 +18,23 @@ |
||
18 | 18 | */ |
19 | 19 | public function boot() |
20 | 20 | { |
21 | - Storage::extend('google', function ($app, $config) { |
|
21 | + Storage::extend('google', function($app, $config) { |
|
22 | 22 | $client = new Google_Client; |
23 | 23 | |
24 | - $client->setClientId($config['clientId']); |
|
25 | - $client->setClientSecret($config['clientSecret']); |
|
26 | - $client->refreshToken($config['refreshToken']); |
|
24 | + $client->setClientId($config[ 'clientId' ]); |
|
25 | + $client->setClientSecret($config[ 'clientSecret' ]); |
|
26 | + $client->refreshToken($config[ 'refreshToken' ]); |
|
27 | 27 | |
28 | 28 | /** @var \Google\Service\Drive|\Google_Service_Drive $service */ |
29 | 29 | $service = new Drive($client); |
30 | 30 | |
31 | - $options = []; |
|
31 | + $options = [ ]; |
|
32 | 32 | |
33 | - if (isset($config['teamDriveId'])) { |
|
34 | - $options['teamDriveId'] = $config['teamDriveId']; |
|
33 | + if (isset($config[ 'teamDriveId' ])) { |
|
34 | + $options[ 'teamDriveId' ] = $config[ 'teamDriveId' ]; |
|
35 | 35 | } |
36 | 36 | |
37 | - $adapter = new GoogleDriveAdapter($service, $config['folderId'], $options); |
|
37 | + $adapter = new GoogleDriveAdapter($service, $config[ 'folderId' ], $options); |
|
38 | 38 | |
39 | 39 | return new Filesystem($adapter); |
40 | 40 | }); |
@@ -20,7 +20,7 @@ discard block |
||
20 | 20 | return 'email'; |
21 | 21 | } |
22 | 22 | |
23 | - if (!Validator::make(['phone' => $value], ['phone' => 'phone:ID'])->fails()) { |
|
23 | + if (!Validator::make([ 'phone' => $value ], [ 'phone' => 'phone:ID' ])->fails()) { |
|
24 | 24 | return 'phone'; |
25 | 25 | } |
26 | 26 | |
@@ -37,15 +37,15 @@ discard block |
||
37 | 37 | { |
38 | 38 | $field = static::getIdentifierField($value); |
39 | 39 | |
40 | - $rules = ['required', 'string', 'exists:' . User::class . ',' . $field]; |
|
40 | + $rules = [ 'required', 'string', 'exists:'.User::class.','.$field ]; |
|
41 | 41 | |
42 | 42 | switch ($field) { |
43 | 43 | case 'email': |
44 | - $rules[] = 'email'; |
|
44 | + $rules[ ] = 'email'; |
|
45 | 45 | break; |
46 | 46 | |
47 | 47 | case 'phone': |
48 | - $rules[] = 'phone:ID'; |
|
48 | + $rules[ ] = 'phone:ID'; |
|
49 | 49 | break; |
50 | 50 | } |
51 | 51 |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | public function attributes() |
34 | 34 | { |
35 | 35 | return [ |
36 | - 'identifier' => trans('Email') . ' / ' .trans('Phone Number') . ' / Username', |
|
36 | + 'identifier' => trans('Email').' / '.trans('Phone Number').' / Username', |
|
37 | 37 | ]; |
38 | 38 | } |
39 | 39 | |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | { |
60 | 60 | $this->ensureIsNotRateLimited(); |
61 | 61 | |
62 | - if (! Auth::attempt(static::getCredentials($this), $this->boolean('remember'))) { |
|
62 | + if (!Auth::attempt(static::getCredentials($this), $this->boolean('remember'))) { |
|
63 | 63 | RateLimiter::hit($this->throttleKey()); |
64 | 64 | |
65 | 65 | throw ValidationException::withMessages([ |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | public function ensureIsNotRateLimited() |
81 | 81 | { |
82 | - if (! RateLimiter::tooManyAttempts($this->throttleKey(), 5)) { |
|
82 | + if (!RateLimiter::tooManyAttempts($this->throttleKey(), 5)) { |
|
83 | 83 | return; |
84 | 84 | } |
85 | 85 | |
@@ -102,6 +102,6 @@ discard block |
||
102 | 102 | */ |
103 | 103 | public function throttleKey() |
104 | 104 | { |
105 | - return Str::lower($this->input('email')) . '|'. $this->ip(); |
|
105 | + return Str::lower($this->input('email')).'|'.$this->ip(); |
|
106 | 106 | } |
107 | 107 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | $this->displayValidationErrorMessage($validationErrorMessage); |
36 | 36 | |
37 | - return $this->askRenderable('conversations.login.ask-identifier', function (Answer $answer) { |
|
37 | + return $this->askRenderable('conversations.login.ask-identifier', function(Answer $answer) { |
|
38 | 38 | if (trim($answer->getText()) === $this->cancelText()) { |
39 | 39 | return $this->cancelLogin(); |
40 | 40 | } |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | return $this->askIdentifier($validator->errors()->first('identifier')); |
47 | 47 | } |
48 | 48 | |
49 | - $this->setUserStorage(['credential_identifier' => $validator->validated()['identifier']]); |
|
49 | + $this->setUserStorage([ 'credential_identifier' => $validator->validated()[ 'identifier' ] ]); |
|
50 | 50 | |
51 | 51 | return $this->askPassword(); |
52 | 52 | }, additionalParameters: Keyboard::create(Keyboard::TYPE_KEYBOARD)->addRow( |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | { |
65 | 65 | $this->displayValidationErrorMessage($validationErrorMessage); |
66 | 66 | |
67 | - return $this->askRenderable('conversations.login.ask-password', function (Answer $answer) { |
|
67 | + return $this->askRenderable('conversations.login.ask-password', function(Answer $answer) { |
|
68 | 68 | if (trim($answer->getText()) === $this->cancelText()) { |
69 | 69 | return $this->cancelLogin(); |
70 | 70 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | return $this->askPassword($validator->errors()->first('password')); |
77 | 77 | } |
78 | 78 | |
79 | - $this->setUserStorage(['credential_password' => $validator->validated()['password']]); |
|
79 | + $this->setUserStorage([ 'credential_password' => $validator->validated()[ 'password' ] ]); |
|
80 | 80 | |
81 | 81 | return $this->runLogin(); |
82 | 82 | }); |
@@ -108,9 +108,9 @@ discard block |
||
108 | 108 | return $this->askIdentifier(trans('auth.failed')); |
109 | 109 | } |
110 | 110 | |
111 | - return $this->sayRenderable('conversations.login.alert-success', additionalParameters: ['reply_markup' => json_encode([ |
|
111 | + return $this->sayRenderable('conversations.login.alert-success', additionalParameters: [ 'reply_markup' => json_encode([ |
|
112 | 112 | 'remove_keyboard' => true, |
113 | - ])]); |
|
113 | + ]) ]); |
|
114 | 114 | } |
115 | 115 | |
116 | 116 | /** |
@@ -130,8 +130,8 @@ discard block |
||
130 | 130 | */ |
131 | 131 | protected function cancelLogin() |
132 | 132 | { |
133 | - return $this->sayRenderable('conversations.login.alert-cancel', additionalParameters: ['reply_markup' => json_encode([ |
|
133 | + return $this->sayRenderable('conversations.login.alert-cancel', additionalParameters: [ 'reply_markup' => json_encode([ |
|
134 | 134 | 'remove_keyboard' => true, |
135 | - ])]); |
|
135 | + ]) ]); |
|
136 | 136 | } |
137 | 137 | } |
@@ -11,6 +11,6 @@ |
||
11 | 11 | */ |
12 | 12 | public function run() |
13 | 13 | { |
14 | - return $this->say('Berikut ini adalah chat ID anda: ' . $this->getUser()->getId()); |
|
14 | + return $this->say('Berikut ini adalah chat ID anda: '.$this->getUser()->getId()); |
|
15 | 15 | } |
16 | 16 | } |
@@ -18,7 +18,7 @@ |
||
18 | 18 | { |
19 | 19 | /** @var \App\Models\User|null $user */ |
20 | 20 | if ($user = User::firstWhere('telegram_chat_id', $this->getUser()->getId())) { |
21 | - $user->update(['telegram_chat_id' => null]); |
|
21 | + $user->update([ 'telegram_chat_id' => null ]); |
|
22 | 22 | |
23 | 23 | return $this->sayRenderable('conversations.logout.alert-success'); |
24 | 24 | } |
@@ -13,8 +13,8 @@ |
||
13 | 13 | */ |
14 | 14 | public function run() |
15 | 15 | { |
16 | - $conversations = HomeConservation::conversations()->mapWithKeys(fn ($conversation) => |
|
17 | - [Arr::first(Arr::wrap($conversation['command'])) => $conversation['description']] |
|
16 | + $conversations = HomeConservation::conversations()->mapWithKeys(fn($conversation) => |
|
17 | + [ Arr::first(Arr::wrap($conversation[ 'command' ])) => $conversation[ 'description' ] ] |
|
18 | 18 | ); |
19 | 19 | |
20 | 20 | return $this |
@@ -18,14 +18,14 @@ |
||
18 | 18 | */ |
19 | 19 | public function up() |
20 | 20 | { |
21 | - Schema::create('users', function (Blueprint $table) { |
|
21 | + Schema::create('users', function(Blueprint $table) { |
|
22 | 22 | $table->id(); |
23 | 23 | $table->foreignIdFor(Branch::class)->constrained()->onUpdate('cascade')->onDelete('cascade'); |
24 | 24 | |
25 | 25 | $table->string('telegram_chat_id')->nullable()->unique(); |
26 | 26 | $table->string('username'); |
27 | 27 | $table->string('fullname'); |
28 | - $table->string('gender')->default(Gender::undefined())->comment('Enum of ' . Gender::class); |
|
28 | + $table->string('gender')->default(Gender::undefined())->comment('Enum of '.Gender::class); |
|
29 | 29 | $table->string('email')->unique(); |
30 | 30 | $table->string('phone_country')->default(env('PHONE_COUNTRY', 'ID')); |
31 | 31 | $table->string('phone')->unique(); |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | { |
36 | 36 | $this->displayValidationErrorMessage($validationErrorMessage); |
37 | 37 | |
38 | - return $this->askRenderable('conversations.check-order-status.ask-code', function (Answer $answer) { |
|
38 | + return $this->askRenderable('conversations.check-order-status.ask-code', function(Answer $answer) { |
|
39 | 39 | if (trim($answer->getText()) === $this->cancelText()) { |
40 | 40 | return $this->cancelCheck(); |
41 | 41 | } |
@@ -46,9 +46,9 @@ discard block |
||
46 | 46 | |
47 | 47 | $order->load('customer:id,fullname', 'user:id,fullname', 'branch', 'items.denomination'); |
48 | 48 | |
49 | - return $this->sayRenderable('conversations.check-order-status.alert-order', compact('order'), [], ['reply_markup' => json_encode([ |
|
49 | + return $this->sayRenderable('conversations.check-order-status.alert-order', compact('order'), [ ], [ 'reply_markup' => json_encode([ |
|
50 | 50 | 'remove_keyboard' => true, |
51 | - ])]); |
|
51 | + ]) ]); |
|
52 | 52 | }, additionalParameters: Keyboard::create(Keyboard::TYPE_KEYBOARD)->addRow( |
53 | 53 | KeyboardButton::create($this->cancelText()) |
54 | 54 | )->toArray()); |
@@ -71,8 +71,8 @@ discard block |
||
71 | 71 | */ |
72 | 72 | protected function cancelCheck() |
73 | 73 | { |
74 | - return $this->sayRenderable('conversations.check-order-status.alert-cancel', additionalParameters: ['reply_markup' => json_encode([ |
|
74 | + return $this->sayRenderable('conversations.check-order-status.alert-cancel', additionalParameters: [ 'reply_markup' => json_encode([ |
|
75 | 75 | 'remove_keyboard' => true, |
76 | - ])]); |
|
76 | + ]) ]); |
|
77 | 77 | } |
78 | 78 | } |