@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | { |
44 | 44 | $this->configureRateLimiting(); |
45 | 45 | |
46 | - $this->routes(function () { |
|
46 | + $this->routes(function() { |
|
47 | 47 | Route::prefix('api') |
48 | 48 | ->middleware('api') |
49 | 49 | ->namespace($this->namespace) |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | ->namespace($this->namespace) |
54 | 54 | ->group(base_path('routes/web.php')); |
55 | 55 | |
56 | - Route::match(['get', 'post'], '/botman', function () { |
|
56 | + Route::match([ 'get', 'post' ], '/botman', function() { |
|
57 | 57 | $this->mapBotManCommands(); |
58 | 58 | })->middleware('web_without_csrf'); |
59 | 59 | }); |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | */ |
69 | 69 | protected function configureRateLimiting() |
70 | 70 | { |
71 | - RateLimiter::for('api', function (Request $request) { |
|
71 | + RateLimiter::for ('api', function(Request $request) { |
|
72 | 72 | return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip()); |
73 | 73 | }); |
74 | 74 | } |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | protected function resolveEnumBinding() |
94 | 94 | { |
95 | 95 | foreach ($this->enums as $name => $class) { |
96 | - Route::bind($name, function ($value) use ($class) { |
|
96 | + Route::bind($name, function($value) use ($class) { |
|
97 | 97 | return $class::from($value); |
98 | 98 | }); |
99 | 99 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function before(?User $user, $ability) |
22 | 22 | { |
23 | - if ($user && $user->hasRole([Role::ROLE_ADMIN, ROLE::ROLE_STAFF])) { |
|
23 | + if ($user && $user->hasRole([ Role::ROLE_ADMIN, ROLE::ROLE_STAFF ])) { |
|
24 | 24 | return true; |
25 | 25 | } |
26 | 26 | } |
@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function before(User $user, $ability) |
22 | 22 | { |
23 | - if ($user->hasRole([Role::ROLE_ADMIN, Role::ROLE_STAFF])) { |
|
23 | + if ($user->hasRole([ Role::ROLE_ADMIN, Role::ROLE_STAFF ])) { |
|
24 | 24 | return true; |
25 | 25 | } |
26 | 26 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | return null; |
42 | 42 | } |
43 | 43 | |
44 | - return Storage::url(static::IDENTITYCARD_IMAGE_PATH . '/' . $value); |
|
44 | + return Storage::url(static::IDENTITYCARD_IMAGE_PATH.'/'.$value); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -65,7 +65,7 @@ discard block |
||
65 | 65 | */ |
66 | 66 | public function getWhatsappPhoneUrlAttribute(): string |
67 | 67 | { |
68 | - return 'https://wa.me/' . Str::replaceFirst('+', '', $this->whatsapp_phone->formatE164()); |
|
68 | + return 'https://wa.me/'.Str::replaceFirst('+', '', $this->whatsapp_phone->formatE164()); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -19,13 +19,13 @@ |
||
19 | 19 | */ |
20 | 20 | protected static function bootEvent() |
21 | 21 | { |
22 | - static::creating(function (Order $model) { |
|
22 | + static::creating(function(Order $model) { |
|
23 | 23 | if (is_null($model->code)) { |
24 | 24 | $model->code = $model->generateCode(); |
25 | 25 | } |
26 | 26 | }); |
27 | 27 | |
28 | - static::deleting(function (Order $model) { |
|
28 | + static::deleting(function(Order $model) { |
|
29 | 29 | $model->statuses->map->delete(); |
30 | 30 | $model->items->map->delete(); |
31 | 31 | }); |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | public static function retrieveByBotManUser(UserInterface $user) |
100 | 100 | { |
101 | 101 | return static::firstWhere([ |
102 | - ['telegram_chat_id', $user->getId()], |
|
103 | - ['username', $user->getUsername()], |
|
102 | + [ 'telegram_chat_id', $user->getId() ], |
|
103 | + [ 'username', $user->getUsername() ], |
|
104 | 104 | ]); |
105 | 105 | } |
106 | 106 | |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | public static function retrieveByUsernameAndEmail(array $credentials) |
114 | 114 | { |
115 | 115 | return static::firstWhere([ |
116 | - ['username', $credentials['username']], |
|
117 | - ['email', $credentials['email']], |
|
116 | + [ 'username', $credentials[ 'username' ] ], |
|
117 | + [ 'email', $credentials[ 'email' ] ], |
|
118 | 118 | ]); |
119 | 119 | } |
120 | 120 | |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | */ |
128 | 128 | public static function updateOrCreateByBotManUser(UserInterface $user, Collection $storage) |
129 | 129 | { |
130 | - return DB::transaction(function () use ($user, $storage) { |
|
130 | + return DB::transaction(function() use ($user, $storage) { |
|
131 | 131 | $attributes = [ |
132 | 132 | 'telegram_chat_id' => $user->getId(), |
133 | 133 | 'username' => $user->getUsername(), |
@@ -154,7 +154,7 @@ discard block |
||
154 | 154 | if ($model) { |
155 | 155 | $model->update($attributes); |
156 | 156 | } else { |
157 | - $model = tap(new static($attributes), function (self $model) { |
|
157 | + $model = tap(new static($attributes), function(self $model) { |
|
158 | 158 | $model->save(); |
159 | 159 | |
160 | 160 | $model->setIssuerableRelationValue($model)->save(); |
@@ -108,7 +108,7 @@ |
||
108 | 108 | * @param array|string $columns |
109 | 109 | * @return \Illuminate\Database\Eloquent\Collection<static> |
110 | 110 | */ |
111 | - public static function getAdmin($columns = ['*']): Collection |
|
111 | + public static function getAdmin($columns = [ '*' ]): Collection |
|
112 | 112 | { |
113 | 113 | return static::role(Role::ROLE_ADMIN)->get($columns); |
114 | 114 | } |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | } |
62 | 62 | |
63 | 63 | if ($relationship->getRelated() instanceof Item) { |
64 | - return $relationship->whereHas('denomination', function (Builder $query) use ($value) { |
|
64 | + return $relationship->whereHas('denomination', function(Builder $query) use ($value) { |
|
65 | 65 | return $query->where('value', $value); |
66 | 66 | })->first(); |
67 | 67 | } |
@@ -80,7 +80,7 @@ discard block |
||
80 | 80 | { |
81 | 81 | $date ??= Carbon::today(); |
82 | 82 | |
83 | - return $prefix . '-' . $date->format('Ymd') . '-' . Str::random(5); |
|
83 | + return $prefix.'-'.$date->format('Ymd').'-'.Str::random(5); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | /** |
@@ -93,12 +93,12 @@ discard block |
||
93 | 93 | */ |
94 | 94 | public static function findOrCreateFromCode(?string $code, Customer $customer, callable $callable = null) |
95 | 95 | { |
96 | - return static::where('code', $code)->firstOr(function () use ($customer, $callable) { |
|
96 | + return static::where('code', $code)->firstOr(function() use ($customer, $callable) { |
|
97 | 97 | $order = new Order; |
98 | 98 | |
99 | 99 | $order->setCustomerRelationValue($customer)->save(); |
100 | 100 | |
101 | - $orderStatus = new ModelOrderStatus(['status' => EnumOrderStatus::draft()]); |
|
101 | + $orderStatus = new ModelOrderStatus([ 'status' => EnumOrderStatus::draft() ]); |
|
102 | 102 | |
103 | 103 | $order->statuses()->save( |
104 | 104 | $orderStatus->setIssuerableRelationValue($customer) |
@@ -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 | /** |