@@ -12,14 +12,14 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('roles', function (Blueprint $table) { |
|
| 15 | + Schema::create('roles', function(Blueprint $table) { |
|
| 16 | 16 | $table->increments('id'); |
| 17 | 17 | $table->string('name', 100)->unique(); |
| 18 | 18 | $table->softDeletes(); |
| 19 | 19 | $table->timestamps(); |
| 20 | 20 | }); |
| 21 | 21 | |
| 22 | - Schema::create('users_roles', function (Blueprint $table) { |
|
| 22 | + Schema::create('users_roles', function(Blueprint $table) { |
|
| 23 | 23 | $table->increments('id'); |
| 24 | 24 | $table->integer('user_id'); |
| 25 | 25 | $table->integer('role_id'); |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * Assign default users to admin roles. |
| 48 | 48 | */ |
| 49 | 49 | $adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id; |
| 50 | - $adminUserId = \DB::table('users')->where('email', '[email protected]')->select('id')->first()->id; |
|
| 50 | + $adminUserId = \DB::table('users')->where('email', '[email protected]')->select('id')->first()->id; |
|
| 51 | 51 | \DB::table('users_roles')->insert( |
| 52 | 52 | [ |
| 53 | 53 | 'user_id' => $adminUserId, |
@@ -1,6 +1,6 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | -$factory->define(App\Modules\Roles\Role::class, function (Faker\Generator $faker) { |
|
| 3 | +$factory->define(App\Modules\Roles\Role::class, function(Faker\Generator $faker) { |
|
| 4 | 4 | return [ |
| 5 | 5 | 'name' => $faker->unique->word(), |
| 6 | 6 | 'created_at' => $faker->dateTimeBetween('-1 years', 'now'), |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | Route::role([ |
| 55 | 55 | 'middleware' => 'web', |
| 56 | 56 | 'namespace' => $this->namespace, |
| 57 | - ], function ($router) { |
|
| 57 | + ], function($router) { |
|
| 58 | 58 | require module_path('roles', 'Routes/web.php', 'app'); |
| 59 | 59 | }); |
| 60 | 60 | } |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | 'middleware' => 'api', |
| 73 | 73 | 'namespace' => $this->namespace, |
| 74 | 74 | 'prefix' => 'api', |
| 75 | - ], function ($router) { |
|
| 75 | + ], function($router) { |
|
| 76 | 76 | require module_path('roles', 'Routes/api.php', 'app'); |
| 77 | 77 | }); |
| 78 | 78 | } |
@@ -25,7 +25,7 @@ |
||
| 25 | 25 | */ |
| 26 | 26 | public function assignPermissions($roleId, $permissionIds) |
| 27 | 27 | { |
| 28 | - \DB::transaction(function () use ($roleId, $permissionIds) { |
|
| 28 | + \DB::transaction(function() use ($roleId, $permissionIds) { |
|
| 29 | 29 | $role = $this->find($roleId); |
| 30 | 30 | $role->permissions()->detach(); |
| 31 | 31 | $role->permissions()->attach($permissionIds); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | | |
| 14 | 14 | */ |
| 15 | 15 | |
| 16 | -Route::role(['prefix' => 'roles'], function () { |
|
| 16 | +Route::role(['prefix' => 'roles'], function() { |
|
| 17 | 17 | |
| 18 | 18 | Route::get('/', 'RoleController@index'); |
| 19 | 19 | Route::get('/{id}', 'RoleController@find'); |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | /** |
| 19 | 19 | * Assign the permissions to the admin role. |
| 20 | 20 | */ |
| 21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['oauthClient'])->each(function ($permission) use ($adminRoleId) { |
|
| 21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['oauthClient'])->each(function($permission) use ($adminRoleId) { |
|
| 22 | 22 | \DB::table('roles_permissions')->insert( |
| 23 | 23 | [ |
| 24 | 24 | 'permission_id' => $permission->id, |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('oauth_clients', function (Blueprint $table) { |
|
| 16 | + Schema::create('oauth_clients', function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->integer('user_id')->nullable(); |
| 19 | 19 | $table->string('name'); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('oauth_personal_access_clients', function (Blueprint $table) { |
|
| 16 | + Schema::create('oauth_personal_access_clients', function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('id'); |
| 18 | 18 | $table->integer('client_id'); |
| 19 | 19 | $table->timestamps(); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('oauth_access_tokens', function (Blueprint $table) { |
|
| 16 | + Schema::create('oauth_access_tokens', function(Blueprint $table) { |
|
| 17 | 17 | $table->string('id', 100)->primary(); |
| 18 | 18 | $table->integer('user_id')->nullable(); |
| 19 | 19 | $table->integer('client_id'); |