@@ -32,13 +32,13 @@ |
||
| 32 | 32 | return [ |
| 33 | 33 | 'username' => 'required|string|max:255|unique:users,username', |
| 34 | 34 | 'fullname' => 'required|string|max:255', |
| 35 | - 'gender' => ['sometimes', 'nullable', Rule::in(Gender::toValues())], |
|
| 35 | + 'gender' => [ 'sometimes', 'nullable', Rule::in(Gender::toValues()) ], |
|
| 36 | 36 | 'email' => 'required|string|email|max:255|unique:users,email', |
| 37 | 37 | 'phone_country' => 'sometimes|in:ID', |
| 38 | - 'phone' => ['required', 'string', 'phone:ID', Rule::unique('users')->where(function ($query) { |
|
| 38 | + 'phone' => [ 'required', 'string', 'phone:ID', Rule::unique('users')->where(function($query) { |
|
| 39 | 39 | $query->where('phone', PhoneNumber::make($this->input('phone'), 'ID')->formatE164()); |
| 40 | - })], |
|
| 41 | - 'password' => ['required', 'confirmed', Rules\Password::defaults()], |
|
| 40 | + }) ], |
|
| 41 | + 'password' => [ 'required', 'confirmed', Rules\Password::defaults() ], |
|
| 42 | 42 | 'agree_with_terms' => 'required|boolean|in:1', |
| 43 | 43 | ]; |
| 44 | 44 | } |
@@ -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 | } |