@@ -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(); |
@@ -19,10 +19,10 @@ |
||
| 19 | 19 | { |
| 20 | 20 | File::ensureDirectoryExists(Storage::path(Denomination::IMAGE_PATH)); |
| 21 | 21 | |
| 22 | - array_map(function (array $attributes) { |
|
| 22 | + array_map(function(array $attributes) { |
|
| 23 | 23 | File::copy( |
| 24 | - resource_path('img/denomination/' . $attributes['image']), |
|
| 25 | - Storage::path(Denomination::IMAGE_PATH . '/' . $attributes['image']) |
|
| 24 | + resource_path('img/denomination/'.$attributes[ 'image' ]), |
|
| 25 | + Storage::path(Denomination::IMAGE_PATH.'/'.$attributes[ 'image' ]) |
|
| 26 | 26 | ); |
| 27 | 27 | |
| 28 | 28 | return Denomination::create($attributes); |
@@ -19,7 +19,7 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | public function up() |
| 21 | 21 | { |
| 22 | - Schema::create('orders', function (Blueprint $table) { |
|
| 22 | + Schema::create('orders', function(Blueprint $table) { |
|
| 23 | 23 | $table->id(); |
| 24 | 24 | $table->foreignIdFor(Customer::class)->constrained()->onUpdate('cascade')->onDelete('cascade'); |
| 25 | 25 | $table->foreignIdFor(User::class)->nullable()->constrained()->onUpdate('cascade')->onDelete('cascade'); |
@@ -18,12 +18,12 @@ |
||
| 18 | 18 | */ |
| 19 | 19 | public function up() |
| 20 | 20 | { |
| 21 | - Schema::create('order_statuses', function (Blueprint $table) { |
|
| 21 | + Schema::create('order_statuses', function(Blueprint $table) { |
|
| 22 | 22 | $table->id(); |
| 23 | 23 | $table->foreignIdFor(Order::class)->constrained()->onUpdate('cascade')->onDelete('cascade'); |
| 24 | 24 | $table->morphs('issuerable'); |
| 25 | 25 | |
| 26 | - $table->string('status')->comment('Enum of ' . OrderStatus::class); |
|
| 26 | + $table->string('status')->comment('Enum of '.OrderStatus::class); |
|
| 27 | 27 | $table->text('note')->nullable(); |
| 28 | 28 | $table->timestamps(); |
| 29 | 29 | }); |
@@ -18,13 +18,13 @@ |
||
| 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('username'); |
| 26 | 26 | $table->string('fullname'); |
| 27 | - $table->string('gender')->default(Gender::undefined())->comment('Enum of ' . Gender::class); |
|
| 27 | + $table->string('gender')->default(Gender::undefined())->comment('Enum of '.Gender::class); |
|
| 28 | 28 | $table->string('email')->unique(); |
| 29 | 29 | $table->string('phone_country')->default(env('PHONE_COUNTRY', 'ID')); |
| 30 | 30 | $table->string('phone')->unique(); |