@@ -70,10 +70,10 @@ |
||
| 70 | 70 | * @param bool $stopOnFirstFailure |
| 71 | 71 | * @return \Illuminate\Contracts\Validation\Validator |
| 72 | 72 | */ |
| 73 | - public static function createValidator($data, string $field, array $messages = [], bool $stopOnFirstFailure = false): ValidationFactory |
|
| 73 | + public static function createValidator($data, string $field, array $messages = [ ], bool $stopOnFirstFailure = false): ValidationFactory |
|
| 74 | 74 | { |
| 75 | 75 | return Validator::make( |
| 76 | - [$field => $data], |
|
| 76 | + [ $field => $data ], |
|
| 77 | 77 | Arr::only(static::getRules(), $field), |
| 78 | 78 | $messages, |
| 79 | 79 | Arr::only(static::getAttributes(), $field) |
@@ -33,7 +33,7 @@ |
||
| 33 | 33 | return [ |
| 34 | 34 | 'male' => trans('Mr.'), |
| 35 | 35 | 'female' => trans('Mrs.'), |
| 36 | - ][$this->value] ?? null; |
|
| 36 | + ][ $this->value ] ?? null; |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | /** |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | public function run() |
| 20 | 20 | { |
| 21 | 21 | if ($customer = Customer::retrieveByBotManUser($this->getUser())) { |
| 22 | - $this->setUserStorage(['gender' => $customer->gender]); |
|
| 22 | + $this->setUserStorage([ 'gender' => $customer->gender ]); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | $name = Str::ucfirst($this->getUser()->getFirstName()); |
@@ -41,12 +41,12 @@ discard block |
||
| 41 | 41 | )->toArray() |
| 42 | 42 | ); |
| 43 | 43 | |
| 44 | - return $this->getBot()->storeConversation($this, next: function (Answer $answer) use ($name, $response) { |
|
| 44 | + return $this->getBot()->storeConversation($this, next: function(Answer $answer) use ($name, $response) { |
|
| 45 | 45 | if (!$answer->isInteractiveMessageReply()) { |
| 46 | 46 | return; |
| 47 | 47 | } |
| 48 | 48 | |
| 49 | - $this->setUserStorage(['gender' => $gender = $answer->getValue()]); |
|
| 49 | + $this->setUserStorage([ 'gender' => $gender = $answer->getValue() ]); |
|
| 50 | 50 | |
| 51 | 51 | $title = $this->getTitle($gender); |
| 52 | 52 | |
@@ -34,12 +34,12 @@ discard block |
||
| 34 | 34 | )->toArray() |
| 35 | 35 | ); |
| 36 | 36 | |
| 37 | - return $this->getBot()->storeConversation($this, next: function (Answer $answer) use ($response) { |
|
| 37 | + return $this->getBot()->storeConversation($this, next: function(Answer $answer) use ($response) { |
|
| 38 | 38 | if (!$answer->isInteractiveMessageReply()) { |
| 39 | 39 | return; |
| 40 | 40 | } |
| 41 | 41 | |
| 42 | - $this->setUserStorage(['gender' => $answer->getValue()]); |
|
| 42 | + $this->setUserStorage([ 'gender' => $answer->getValue() ]); |
|
| 43 | 43 | |
| 44 | 44 | $this->deleteTelegramMessageFromResponse($response); |
| 45 | 45 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | { |
| 55 | 55 | $this->displayValidationErrorMessage($validationErrorMessage); |
| 56 | 56 | |
| 57 | - return $this->askRenderable('conversations.exchange.ask-email', function (Answer $answer) { |
|
| 57 | + return $this->askRenderable('conversations.exchange.ask-email', function(Answer $answer) { |
|
| 58 | 58 | $value = $answer->getText(); |
| 59 | 59 | $validator = CustomerUpdateRequest::createValidator($value, 'email'); |
| 60 | 60 | |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | return $this->askEmail($validator->errors()->first('email')); |
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $this->setUserStorage(['email' => $validator->validated()['email']]); |
|
| 65 | + $this->setUserStorage([ 'email' => $validator->validated()[ 'email' ] ]); |
|
| 66 | 66 | |
| 67 | 67 | return $this->askFullName(); |
| 68 | 68 | }); |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | { |
| 76 | 76 | $this->displayValidationErrorMessage($validationErrorMessage); |
| 77 | 77 | |
| 78 | - return $this->askRenderable('conversations.register-customer.ask-phone', function () { |
|
| 78 | + return $this->askRenderable('conversations.register-customer.ask-phone', function() { |
|
| 79 | 79 | $value = $this->getMessagePayload('contact.phone_number'); |
| 80 | 80 | $validator = CustomerUpdateRequest::createValidator($value, 'phone'); |
| 81 | 81 | |
@@ -83,14 +83,14 @@ discard block |
||
| 83 | 83 | return $this->askPhone($validator->errors()->first('phone')); |
| 84 | 84 | } |
| 85 | 85 | |
| 86 | - $this->setUserStorage(['phone' => $validator->validated()['phone']]); |
|
| 86 | + $this->setUserStorage([ 'phone' => $validator->validated()[ 'phone' ] ]); |
|
| 87 | 87 | |
| 88 | 88 | return $this->askWhatsappPhone(); |
| 89 | - }, additionalParameters: ['reply_markup' => json_encode([ |
|
| 90 | - 'keyboard' => [[['text' => '☎️ ' . trans('Send My Phone Number'), 'request_contact' => true]]], |
|
| 89 | + }, additionalParameters: [ 'reply_markup' => json_encode([ |
|
| 90 | + 'keyboard' => [ [ [ 'text' => '☎️ '.trans('Send My Phone Number'), 'request_contact' => true ] ] ], |
|
| 91 | 91 | 'resize_keyboard' => true, |
| 92 | 92 | 'one_time_keyboard' => true, |
| 93 | 93 | 'remove_keyboard' => true, |
| 94 | - ])]); |
|
| 94 | + ]) ]); |
|
| 95 | 95 | } |
| 96 | 96 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | public function isRelationValueDirty($relations = null): bool |
| 22 | 22 | { |
| 23 | - $attributes = array_map(function ($name) { |
|
| 23 | + $attributes = array_map(function($name) { |
|
| 24 | 24 | $relation = $this->$name(); |
| 25 | 25 | |
| 26 | 26 | if (!$relation instanceof Relation || !method_exists($relation, 'getForeignKeyName')) { |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | */ |
| 49 | 49 | protected function isCollectionValid(Collection $models, string $className, bool $throwExceptionWhenNotValid = true): bool |
| 50 | 50 | { |
| 51 | - return $models->every(function (Model $model) use ($className, $throwExceptionWhenNotValid) { |
|
| 51 | + return $models->every(function(Model $model) use ($className, $throwExceptionWhenNotValid) { |
|
| 52 | 52 | $isValid = $model instanceof $className; |
| 53 | 53 | |
| 54 | 54 | if (!$isValid && $throwExceptionWhenNotValid) { |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('failed_jobs', function (Blueprint $table) { |
|
| 16 | + Schema::create('failed_jobs', function(Blueprint $table) { |
|
| 17 | 17 | $table->id(); |
| 18 | 18 | |
| 19 | 19 | $table->string('uuid')->unique(); |
@@ -20,71 +20,71 @@ discard block |
||
| 20 | 20 | throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.'); |
| 21 | 21 | } |
| 22 | 22 | |
| 23 | - Schema::create($tableNames['permissions'], function (Blueprint $table) { |
|
| 23 | + Schema::create($tableNames[ 'permissions' ], function(Blueprint $table) { |
|
| 24 | 24 | $table->bigIncrements('id'); |
| 25 | - $table->string('name'); // For MySQL 8.0 use string('name', 125); |
|
| 25 | + $table->string('name'); // For MySQL 8.0 use string('name', 125); |
|
| 26 | 26 | $table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125); |
| 27 | 27 | $table->timestamps(); |
| 28 | 28 | |
| 29 | - $table->unique(['name', 'guard_name']); |
|
| 29 | + $table->unique([ 'name', 'guard_name' ]); |
|
| 30 | 30 | }); |
| 31 | 31 | |
| 32 | - Schema::create($tableNames['roles'], function (Blueprint $table) { |
|
| 32 | + Schema::create($tableNames[ 'roles' ], function(Blueprint $table) { |
|
| 33 | 33 | $table->bigIncrements('id'); |
| 34 | - $table->string('name'); // For MySQL 8.0 use string('name', 125); |
|
| 34 | + $table->string('name'); // For MySQL 8.0 use string('name', 125); |
|
| 35 | 35 | $table->string('guard_name'); // For MySQL 8.0 use string('guard_name', 125); |
| 36 | 36 | $table->timestamps(); |
| 37 | 37 | |
| 38 | - $table->unique(['name', 'guard_name']); |
|
| 38 | + $table->unique([ 'name', 'guard_name' ]); |
|
| 39 | 39 | }); |
| 40 | 40 | |
| 41 | - Schema::create($tableNames['model_has_permissions'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
| 41 | + Schema::create($tableNames[ 'model_has_permissions' ], function(Blueprint $table) use ($tableNames, $columnNames) { |
|
| 42 | 42 | $table->unsignedBigInteger('permission_id'); |
| 43 | 43 | |
| 44 | 44 | $table->string('model_type'); |
| 45 | - $table->unsignedBigInteger($columnNames['model_morph_key']); |
|
| 46 | - $table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index'); |
|
| 45 | + $table->unsignedBigInteger($columnNames[ 'model_morph_key' ]); |
|
| 46 | + $table->index([ $columnNames[ 'model_morph_key' ], 'model_type' ], 'model_has_permissions_model_id_model_type_index'); |
|
| 47 | 47 | |
| 48 | 48 | $table->foreign('permission_id') |
| 49 | 49 | ->references('id') |
| 50 | - ->on($tableNames['permissions']) |
|
| 50 | + ->on($tableNames[ 'permissions' ]) |
|
| 51 | 51 | ->onDelete('cascade'); |
| 52 | 52 | |
| 53 | - $table->primary(['permission_id', $columnNames['model_morph_key'], 'model_type'], |
|
| 53 | + $table->primary([ 'permission_id', $columnNames[ 'model_morph_key' ], 'model_type' ], |
|
| 54 | 54 | 'model_has_permissions_permission_model_type_primary'); |
| 55 | 55 | }); |
| 56 | 56 | |
| 57 | - Schema::create($tableNames['model_has_roles'], function (Blueprint $table) use ($tableNames, $columnNames) { |
|
| 57 | + Schema::create($tableNames[ 'model_has_roles' ], function(Blueprint $table) use ($tableNames, $columnNames) { |
|
| 58 | 58 | $table->unsignedBigInteger('role_id'); |
| 59 | 59 | |
| 60 | 60 | $table->string('model_type'); |
| 61 | - $table->unsignedBigInteger($columnNames['model_morph_key']); |
|
| 62 | - $table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index'); |
|
| 61 | + $table->unsignedBigInteger($columnNames[ 'model_morph_key' ]); |
|
| 62 | + $table->index([ $columnNames[ 'model_morph_key' ], 'model_type' ], 'model_has_roles_model_id_model_type_index'); |
|
| 63 | 63 | |
| 64 | 64 | $table->foreign('role_id') |
| 65 | 65 | ->references('id') |
| 66 | - ->on($tableNames['roles']) |
|
| 66 | + ->on($tableNames[ 'roles' ]) |
|
| 67 | 67 | ->onDelete('cascade'); |
| 68 | 68 | |
| 69 | - $table->primary(['role_id', $columnNames['model_morph_key'], 'model_type'], |
|
| 69 | + $table->primary([ 'role_id', $columnNames[ 'model_morph_key' ], 'model_type' ], |
|
| 70 | 70 | 'model_has_roles_role_model_type_primary'); |
| 71 | 71 | }); |
| 72 | 72 | |
| 73 | - Schema::create($tableNames['role_has_permissions'], function (Blueprint $table) use ($tableNames) { |
|
| 73 | + Schema::create($tableNames[ 'role_has_permissions' ], function(Blueprint $table) use ($tableNames) { |
|
| 74 | 74 | $table->unsignedBigInteger('permission_id'); |
| 75 | 75 | $table->unsignedBigInteger('role_id'); |
| 76 | 76 | |
| 77 | 77 | $table->foreign('permission_id') |
| 78 | 78 | ->references('id') |
| 79 | - ->on($tableNames['permissions']) |
|
| 79 | + ->on($tableNames[ 'permissions' ]) |
|
| 80 | 80 | ->onDelete('cascade'); |
| 81 | 81 | |
| 82 | 82 | $table->foreign('role_id') |
| 83 | 83 | ->references('id') |
| 84 | - ->on($tableNames['roles']) |
|
| 84 | + ->on($tableNames[ 'roles' ]) |
|
| 85 | 85 | ->onDelete('cascade'); |
| 86 | 86 | |
| 87 | - $table->primary(['permission_id', 'role_id'], 'role_has_permissions_permission_id_role_id_primary'); |
|
| 87 | + $table->primary([ 'permission_id', 'role_id' ], 'role_has_permissions_permission_id_role_id_primary'); |
|
| 88 | 88 | }); |
| 89 | 89 | |
| 90 | 90 | app('cache') |
@@ -105,10 +105,10 @@ discard block |
||
| 105 | 105 | throw new \Exception('Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.'); |
| 106 | 106 | } |
| 107 | 107 | |
| 108 | - Schema::drop($tableNames['role_has_permissions']); |
|
| 109 | - Schema::drop($tableNames['model_has_roles']); |
|
| 110 | - Schema::drop($tableNames['model_has_permissions']); |
|
| 111 | - Schema::drop($tableNames['roles']); |
|
| 112 | - Schema::drop($tableNames['permissions']); |
|
| 108 | + Schema::drop($tableNames[ 'role_has_permissions' ]); |
|
| 109 | + Schema::drop($tableNames[ 'model_has_roles' ]); |
|
| 110 | + Schema::drop($tableNames[ 'model_has_permissions' ]); |
|
| 111 | + Schema::drop($tableNames[ 'roles' ]); |
|
| 112 | + Schema::drop($tableNames[ 'permissions' ]); |
|
| 113 | 113 | } |
| 114 | 114 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('jobs', function (Blueprint $table) { |
|
| 16 | + Schema::create('jobs', function(Blueprint $table) { |
|
| 17 | 17 | $table->id(); |
| 18 | 18 | |
| 19 | 19 | $table->string('queue')->index(); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('password_resets', function (Blueprint $table) { |
|
| 16 | + Schema::create('password_resets', function(Blueprint $table) { |
|
| 17 | 17 | $table->string('email')->index(); |
| 18 | 18 | $table->string('token'); |
| 19 | 19 | $table->timestamp('created_at')->nullable(); |