@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | */ |
| 21 | 21 | $role = Role::updateOrInsert([ |
| 22 | 22 | 'name' => 'Admin', |
| 23 | - ],[ |
|
| 23 | + ], [ |
|
| 24 | 24 | 'created_at' => \DB::raw('NOW()'), |
| 25 | 25 | 'updated_at' => \DB::raw('NOW()') |
| 26 | 26 | ]); |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | */ |
| 31 | 31 | AclUser::updateOrInsert([ |
| 32 | 32 | 'email' => '[email protected]', |
| 33 | - ],[ |
|
| 33 | + ], [ |
|
| 34 | 34 | 'name' => 'Admin', |
| 35 | 35 | 'password' => \Hash::make('123456'), |
| 36 | 36 | 'confirmed' => 1, |
@@ -8,105 +8,105 @@ |
||
| 8 | 8 | |
| 9 | 9 | class UsersTableSeeder extends Seeder |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * Run the database seeds. |
|
| 13 | - * |
|
| 14 | - * @return void |
|
| 15 | - */ |
|
| 16 | - public function run() |
|
| 17 | - { |
|
| 18 | - /** |
|
| 19 | - * Create Default roles. |
|
| 20 | - */ |
|
| 21 | - $role = Role::updateOrInsert([ |
|
| 22 | - 'name' => 'Admin', |
|
| 23 | - ],[ |
|
| 24 | - 'created_at' => \DB::raw('NOW()'), |
|
| 25 | - 'updated_at' => \DB::raw('NOW()') |
|
| 26 | - ]); |
|
| 11 | + /** |
|
| 12 | + * Run the database seeds. |
|
| 13 | + * |
|
| 14 | + * @return void |
|
| 15 | + */ |
|
| 16 | + public function run() |
|
| 17 | + { |
|
| 18 | + /** |
|
| 19 | + * Create Default roles. |
|
| 20 | + */ |
|
| 21 | + $role = Role::updateOrInsert([ |
|
| 22 | + 'name' => 'Admin', |
|
| 23 | + ],[ |
|
| 24 | + 'created_at' => \DB::raw('NOW()'), |
|
| 25 | + 'updated_at' => \DB::raw('NOW()') |
|
| 26 | + ]); |
|
| 27 | 27 | |
| 28 | - /** |
|
| 29 | - * Create Default user. |
|
| 30 | - */ |
|
| 31 | - AclUser::updateOrInsert([ |
|
| 32 | - 'email' => '[email protected]', |
|
| 33 | - ],[ |
|
| 34 | - 'name' => 'Admin', |
|
| 35 | - 'password' => \Hash::make('123456'), |
|
| 36 | - 'confirmed' => 1, |
|
| 37 | - 'created_at' => \DB::raw('NOW()'), |
|
| 38 | - 'updated_at' => \DB::raw('NOW()') |
|
| 39 | - ]); |
|
| 28 | + /** |
|
| 29 | + * Create Default user. |
|
| 30 | + */ |
|
| 31 | + AclUser::updateOrInsert([ |
|
| 32 | + 'email' => '[email protected]', |
|
| 33 | + ],[ |
|
| 34 | + 'name' => 'Admin', |
|
| 35 | + 'password' => \Hash::make('123456'), |
|
| 36 | + 'confirmed' => 1, |
|
| 37 | + 'created_at' => \DB::raw('NOW()'), |
|
| 38 | + 'updated_at' => \DB::raw('NOW()') |
|
| 39 | + ]); |
|
| 40 | 40 | |
| 41 | - /** |
|
| 42 | - * Insert the permissions related to users table. |
|
| 43 | - */ |
|
| 44 | - \DB::table('permissions')->insert( |
|
| 45 | - [ |
|
| 46 | - /** |
|
| 47 | - * Users model permissions. |
|
| 48 | - */ |
|
| 49 | - [ |
|
| 50 | - 'name' => 'index', |
|
| 51 | - 'model' => 'user', |
|
| 52 | - 'created_at' => \DB::raw('NOW()'), |
|
| 53 | - 'updated_at' => \DB::raw('NOW()') |
|
| 54 | - ], |
|
| 55 | - [ |
|
| 56 | - 'name' => 'show', |
|
| 57 | - 'model' => 'user', |
|
| 58 | - 'created_at' => \DB::raw('NOW()'), |
|
| 59 | - 'updated_at' => \DB::raw('NOW()') |
|
| 60 | - ], |
|
| 61 | - [ |
|
| 62 | - 'name' => 'store', |
|
| 63 | - 'model' => 'user', |
|
| 64 | - 'created_at' => \DB::raw('NOW()'), |
|
| 65 | - 'updated_at' => \DB::raw('NOW()') |
|
| 66 | - ], |
|
| 67 | - [ |
|
| 68 | - 'name' => 'update', |
|
| 69 | - 'model' => 'user', |
|
| 70 | - 'created_at' => \DB::raw('NOW()'), |
|
| 71 | - 'updated_at' => \DB::raw('NOW()') |
|
| 72 | - ], |
|
| 73 | - [ |
|
| 74 | - 'name' => 'destroy', |
|
| 75 | - 'model' => 'user', |
|
| 76 | - 'created_at' => \DB::raw('NOW()'), |
|
| 77 | - 'updated_at' => \DB::raw('NOW()') |
|
| 78 | - ], |
|
| 79 | - [ |
|
| 80 | - 'name' => 'deleted', |
|
| 81 | - 'model' => 'user', |
|
| 82 | - 'created_at' => \DB::raw('NOW()'), |
|
| 83 | - 'updated_at' => \DB::raw('NOW()') |
|
| 84 | - ], |
|
| 85 | - [ |
|
| 86 | - 'name' => 'restore', |
|
| 87 | - 'model' => 'user', |
|
| 88 | - 'created_at' => \DB::raw('NOW()'), |
|
| 89 | - 'updated_at' => \DB::raw('NOW()') |
|
| 90 | - ], |
|
| 91 | - [ |
|
| 92 | - 'name' => 'assignRoles', |
|
| 93 | - 'model' => 'user', |
|
| 94 | - 'created_at' => \DB::raw('NOW()'), |
|
| 95 | - 'updated_at' => \DB::raw('NOW()') |
|
| 96 | - ], |
|
| 97 | - [ |
|
| 98 | - 'name' => 'block', |
|
| 99 | - 'model' => 'user', |
|
| 100 | - 'created_at' => \DB::raw('NOW()'), |
|
| 101 | - 'updated_at' => \DB::raw('NOW()') |
|
| 102 | - ], |
|
| 103 | - [ |
|
| 104 | - 'name' => 'unblock', |
|
| 105 | - 'model' => 'user', |
|
| 106 | - 'created_at' => \DB::raw('NOW()'), |
|
| 107 | - 'updated_at' => \DB::raw('NOW()') |
|
| 108 | - ] |
|
| 109 | - ] |
|
| 110 | - ); |
|
| 111 | - } |
|
| 41 | + /** |
|
| 42 | + * Insert the permissions related to users table. |
|
| 43 | + */ |
|
| 44 | + \DB::table('permissions')->insert( |
|
| 45 | + [ |
|
| 46 | + /** |
|
| 47 | + * Users model permissions. |
|
| 48 | + */ |
|
| 49 | + [ |
|
| 50 | + 'name' => 'index', |
|
| 51 | + 'model' => 'user', |
|
| 52 | + 'created_at' => \DB::raw('NOW()'), |
|
| 53 | + 'updated_at' => \DB::raw('NOW()') |
|
| 54 | + ], |
|
| 55 | + [ |
|
| 56 | + 'name' => 'show', |
|
| 57 | + 'model' => 'user', |
|
| 58 | + 'created_at' => \DB::raw('NOW()'), |
|
| 59 | + 'updated_at' => \DB::raw('NOW()') |
|
| 60 | + ], |
|
| 61 | + [ |
|
| 62 | + 'name' => 'store', |
|
| 63 | + 'model' => 'user', |
|
| 64 | + 'created_at' => \DB::raw('NOW()'), |
|
| 65 | + 'updated_at' => \DB::raw('NOW()') |
|
| 66 | + ], |
|
| 67 | + [ |
|
| 68 | + 'name' => 'update', |
|
| 69 | + 'model' => 'user', |
|
| 70 | + 'created_at' => \DB::raw('NOW()'), |
|
| 71 | + 'updated_at' => \DB::raw('NOW()') |
|
| 72 | + ], |
|
| 73 | + [ |
|
| 74 | + 'name' => 'destroy', |
|
| 75 | + 'model' => 'user', |
|
| 76 | + 'created_at' => \DB::raw('NOW()'), |
|
| 77 | + 'updated_at' => \DB::raw('NOW()') |
|
| 78 | + ], |
|
| 79 | + [ |
|
| 80 | + 'name' => 'deleted', |
|
| 81 | + 'model' => 'user', |
|
| 82 | + 'created_at' => \DB::raw('NOW()'), |
|
| 83 | + 'updated_at' => \DB::raw('NOW()') |
|
| 84 | + ], |
|
| 85 | + [ |
|
| 86 | + 'name' => 'restore', |
|
| 87 | + 'model' => 'user', |
|
| 88 | + 'created_at' => \DB::raw('NOW()'), |
|
| 89 | + 'updated_at' => \DB::raw('NOW()') |
|
| 90 | + ], |
|
| 91 | + [ |
|
| 92 | + 'name' => 'assignRoles', |
|
| 93 | + 'model' => 'user', |
|
| 94 | + 'created_at' => \DB::raw('NOW()'), |
|
| 95 | + 'updated_at' => \DB::raw('NOW()') |
|
| 96 | + ], |
|
| 97 | + [ |
|
| 98 | + 'name' => 'block', |
|
| 99 | + 'model' => 'user', |
|
| 100 | + 'created_at' => \DB::raw('NOW()'), |
|
| 101 | + 'updated_at' => \DB::raw('NOW()') |
|
| 102 | + ], |
|
| 103 | + [ |
|
| 104 | + 'name' => 'unblock', |
|
| 105 | + 'model' => 'user', |
|
| 106 | + 'created_at' => \DB::raw('NOW()'), |
|
| 107 | + 'updated_at' => \DB::raw('NOW()') |
|
| 108 | + ] |
|
| 109 | + ] |
|
| 110 | + ); |
|
| 111 | + } |
|
| 112 | 112 | } |
@@ -6,27 +6,27 @@ |
||
| 6 | 6 | |
| 7 | 7 | class AssignRelationsSeeder extends Seeder |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the database seeds. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function run() |
|
| 15 | - { |
|
| 16 | - $adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id; |
|
| 9 | + /** |
|
| 10 | + * Run the database seeds. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function run() |
|
| 15 | + { |
|
| 16 | + $adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Assign the permissions to the admin role. |
|
| 20 | - */ |
|
| 21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['user'])->each(function ($permission) use ($adminRoleId) { |
|
| 22 | - \DB::table('permission_role')->insert( |
|
| 23 | - [ |
|
| 24 | - 'permission_id' => $permission->id, |
|
| 25 | - 'role_id' => $adminRoleId, |
|
| 26 | - 'created_at' => \DB::raw('NOW()'), |
|
| 27 | - 'updated_at' => \DB::raw('NOW()') |
|
| 28 | - ] |
|
| 29 | - ); |
|
| 30 | - }); |
|
| 31 | - } |
|
| 18 | + /** |
|
| 19 | + * Assign the permissions to the admin role. |
|
| 20 | + */ |
|
| 21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['user'])->each(function ($permission) use ($adminRoleId) { |
|
| 22 | + \DB::table('permission_role')->insert( |
|
| 23 | + [ |
|
| 24 | + 'permission_id' => $permission->id, |
|
| 25 | + 'role_id' => $adminRoleId, |
|
| 26 | + 'created_at' => \DB::raw('NOW()'), |
|
| 27 | + 'updated_at' => \DB::raw('NOW()') |
|
| 28 | + ] |
|
| 29 | + ); |
|
| 30 | + }); |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -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', ['user'])->each(function ($permission) use ($adminRoleId) { |
|
| 21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['user'])->each(function($permission) use ($adminRoleId) { |
|
| 22 | 22 | \DB::table('permission_role')->insert( |
| 23 | 23 | [ |
| 24 | 24 | 'permission_id' => $permission->id, |
@@ -6,15 +6,15 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ClearDataSeeder extends Seeder |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the database seeds. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function run() |
|
| 15 | - { |
|
| 16 | - $permissions = \DB::table('permissions')->whereIn('model', ['user']); |
|
| 17 | - \DB::table('permission_role')->whereIn('permission_id', $permissions->pluck('id'))->delete(); |
|
| 18 | - $permissions->delete(); |
|
| 19 | - } |
|
| 9 | + /** |
|
| 10 | + * Run the database seeds. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function run() |
|
| 15 | + { |
|
| 16 | + $permissions = \DB::table('permissions')->whereIn('model', ['user']); |
|
| 17 | + \DB::table('permission_role')->whereIn('permission_id', $permissions->pluck('id'))->delete(); |
|
| 18 | + $permissions->delete(); |
|
| 19 | + } |
|
| 20 | 20 | } |
@@ -8,14 +8,14 @@ |
||
| 8 | 8 | |
| 9 | 9 | class PushNotificationDeviceRepository extends BaseRepository |
| 10 | 10 | { |
| 11 | - /** |
|
| 12 | - * Init new object. |
|
| 13 | - * |
|
| 14 | - * @param PushNotificationDevice $model |
|
| 15 | - * @return void |
|
| 16 | - */ |
|
| 17 | - public function __construct(PushNotificationDevice $model) |
|
| 18 | - { |
|
| 19 | - parent::__construct($model); |
|
| 20 | - } |
|
| 11 | + /** |
|
| 12 | + * Init new object. |
|
| 13 | + * |
|
| 14 | + * @param PushNotificationDevice $model |
|
| 15 | + * @return void |
|
| 16 | + */ |
|
| 17 | + public function __construct(PushNotificationDevice $model) |
|
| 18 | + { |
|
| 19 | + parent::__construct($model); |
|
| 20 | + } |
|
| 21 | 21 | } |
@@ -3,9 +3,6 @@ |
||
| 3 | 3 | namespace App\Modules\PushNotificationDevices\Repositories; |
| 4 | 4 | |
| 5 | 5 | use App\Modules\Core\BaseClasses\BaseRepository; |
| 6 | -use LaravelFCM\Message\OptionsBuilder; |
|
| 7 | -use LaravelFCM\Message\PayloadDataBuilder; |
|
| 8 | -use LaravelFCM\Message\PayloadNotificationBuilder; |
|
| 9 | 6 | use App\Modules\PushNotificationDevices\PushNotificationDevice; |
| 10 | 7 | |
| 11 | 8 | class PushNotificationDeviceRepository extends BaseRepository |
@@ -6,27 +6,27 @@ |
||
| 6 | 6 | |
| 7 | 7 | class AssignRelationsSeeder extends Seeder |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the database seeds. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function run() |
|
| 15 | - { |
|
| 16 | - $adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id; |
|
| 9 | + /** |
|
| 10 | + * Run the database seeds. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function run() |
|
| 15 | + { |
|
| 16 | + $adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Assign the permissions to the admin role. |
|
| 20 | - */ |
|
| 21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['pushNotificationDevice'])->each(function ($permission) use ($adminRoleId) { |
|
| 22 | - \DB::table('permission_role')->insert( |
|
| 23 | - [ |
|
| 24 | - 'permission_id' => $permission->id, |
|
| 25 | - 'role_id' => $adminRoleId, |
|
| 26 | - 'created_at' => \DB::raw('NOW()'), |
|
| 27 | - 'updated_at' => \DB::raw('NOW()') |
|
| 28 | - ] |
|
| 29 | - ); |
|
| 30 | - }); |
|
| 31 | - } |
|
| 18 | + /** |
|
| 19 | + * Assign the permissions to the admin role. |
|
| 20 | + */ |
|
| 21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['pushNotificationDevice'])->each(function ($permission) use ($adminRoleId) { |
|
| 22 | + \DB::table('permission_role')->insert( |
|
| 23 | + [ |
|
| 24 | + 'permission_id' => $permission->id, |
|
| 25 | + 'role_id' => $adminRoleId, |
|
| 26 | + 'created_at' => \DB::raw('NOW()'), |
|
| 27 | + 'updated_at' => \DB::raw('NOW()') |
|
| 28 | + ] |
|
| 29 | + ); |
|
| 30 | + }); |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -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', ['pushNotificationDevice'])->each(function ($permission) use ($adminRoleId) { |
|
| 21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['pushNotificationDevice'])->each(function($permission) use ($adminRoleId) { |
|
| 22 | 22 | \DB::table('permission_role')->insert( |
| 23 | 23 | [ |
| 24 | 24 | 'permission_id' => $permission->id, |
@@ -6,15 +6,15 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ClearDataSeeder extends Seeder |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the database seeds. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function run() |
|
| 15 | - { |
|
| 16 | - $permissions = \DB::table('permissions')->whereIn('model', ['pushNotificationDevice']); |
|
| 17 | - \DB::table('permission_role')->whereIn('permission_id', $permissions->pluck('id'))->delete(); |
|
| 18 | - $permissions->delete(); |
|
| 19 | - } |
|
| 9 | + /** |
|
| 10 | + * Run the database seeds. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function run() |
|
| 15 | + { |
|
| 16 | + $permissions = \DB::table('permissions')->whereIn('model', ['pushNotificationDevice']); |
|
| 17 | + \DB::table('permission_role')->whereIn('permission_id', $permissions->pluck('id'))->delete(); |
|
| 18 | + $permissions->delete(); |
|
| 19 | + } |
|
| 20 | 20 | } |
@@ -6,27 +6,27 @@ |
||
| 6 | 6 | |
| 7 | 7 | class AssignRelationsSeeder extends Seeder |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the database seeds. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function run() |
|
| 15 | - { |
|
| 16 | - $adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id; |
|
| 9 | + /** |
|
| 10 | + * Run the database seeds. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function run() |
|
| 15 | + { |
|
| 16 | + $adminRoleId = \DB::table('roles')->where('name', 'admin')->select('id')->first()->id; |
|
| 17 | 17 | |
| 18 | - /** |
|
| 19 | - * Assign the permissions to the admin role. |
|
| 20 | - */ |
|
| 21 | - \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['permission'])->each(function ($permission) use ($adminRoleId) { |
|
| 22 | - \DB::table('permission_role')->insert( |
|
| 23 | - [ |
|
| 24 | - 'permission_id' => $permission->id, |
|
| 25 | - 'role_id' => $adminRoleId, |
|
| 26 | - 'created_at' => \DB::raw('NOW()'), |
|
| 27 | - 'updated_at' => \DB::raw('NOW()') |
|
| 28 | - ] |
|
| 29 | - ); |
|
| 30 | - }); |
|
| 31 | - } |
|
| 18 | + /** |
|
| 19 | + * Assign the permissions to the admin role. |
|
| 20 | + */ |
|
| 21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['permission'])->each(function ($permission) use ($adminRoleId) { |
|
| 22 | + \DB::table('permission_role')->insert( |
|
| 23 | + [ |
|
| 24 | + 'permission_id' => $permission->id, |
|
| 25 | + 'role_id' => $adminRoleId, |
|
| 26 | + 'created_at' => \DB::raw('NOW()'), |
|
| 27 | + 'updated_at' => \DB::raw('NOW()') |
|
| 28 | + ] |
|
| 29 | + ); |
|
| 30 | + }); |
|
| 31 | + } |
|
| 32 | 32 | } |
@@ -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', ['permission'])->each(function ($permission) use ($adminRoleId) { |
|
| 21 | + \DB::table('permissions')->orderBy('created_at', 'asc')->whereIn('model', ['permission'])->each(function($permission) use ($adminRoleId) { |
|
| 22 | 22 | \DB::table('permission_role')->insert( |
| 23 | 23 | [ |
| 24 | 24 | 'permission_id' => $permission->id, |
@@ -6,15 +6,15 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ClearDataSeeder extends Seeder |
| 8 | 8 | { |
| 9 | - /** |
|
| 10 | - * Run the database seeds. |
|
| 11 | - * |
|
| 12 | - * @return void |
|
| 13 | - */ |
|
| 14 | - public function run() |
|
| 15 | - { |
|
| 16 | - $permissions = \DB::table('permissions')->whereIn('model', ['permission']); |
|
| 17 | - \DB::table('permission_role')->whereIn('permission_id', $permissions->pluck('id'))->delete(); |
|
| 18 | - $permissions->delete(); |
|
| 19 | - } |
|
| 9 | + /** |
|
| 10 | + * Run the database seeds. |
|
| 11 | + * |
|
| 12 | + * @return void |
|
| 13 | + */ |
|
| 14 | + public function run() |
|
| 15 | + { |
|
| 16 | + $permissions = \DB::table('permissions')->whereIn('model', ['permission']); |
|
| 17 | + \DB::table('permission_role')->whereIn('permission_id', $permissions->pluck('id'))->delete(); |
|
| 18 | + $permissions->delete(); |
|
| 19 | + } |
|
| 20 | 20 | } |
@@ -12,7 +12,7 @@ discard block |
||
| 12 | 12 | */ |
| 13 | 13 | public function up() |
| 14 | 14 | { |
| 15 | - Schema::create('permissions', function (Blueprint $table) { |
|
| 15 | + Schema::create('permissions', function(Blueprint $table) { |
|
| 16 | 16 | $table->increments('id'); |
| 17 | 17 | $table->string('name', 100); |
| 18 | 18 | $table->string('model', 100); |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | $table->timestamps(); |
| 21 | 21 | $table->unique(array('name', 'model')); |
| 22 | 22 | }); |
| 23 | - Schema::create('permission_role', function (Blueprint $table) { |
|
| 23 | + Schema::create('permission_role', function(Blueprint $table) { |
|
| 24 | 24 | $table->increments('id'); |
| 25 | 25 | $table->unsignedInteger('role_id'); |
| 26 | 26 | $table->unsignedInteger('permission_id'); |
@@ -5,41 +5,41 @@ |
||
| 5 | 5 | |
| 6 | 6 | class Permissions extends Migration |
| 7 | 7 | { |
| 8 | - /** |
|
| 9 | - * Run the migrations. |
|
| 10 | - * |
|
| 11 | - * @return void |
|
| 12 | - */ |
|
| 13 | - public function up() |
|
| 14 | - { |
|
| 15 | - Schema::create('permissions', function (Blueprint $table) { |
|
| 16 | - $table->increments('id'); |
|
| 17 | - $table->string('name', 100); |
|
| 18 | - $table->string('model', 100); |
|
| 19 | - $table->softDeletes(); |
|
| 20 | - $table->timestamps(); |
|
| 21 | - $table->unique(array('name', 'model')); |
|
| 22 | - }); |
|
| 23 | - Schema::create('permission_role', function (Blueprint $table) { |
|
| 24 | - $table->increments('id'); |
|
| 25 | - $table->unsignedInteger('role_id'); |
|
| 26 | - $table->unsignedInteger('permission_id'); |
|
| 27 | - $table->softDeletes(); |
|
| 28 | - $table->timestamps(); |
|
| 8 | + /** |
|
| 9 | + * Run the migrations. |
|
| 10 | + * |
|
| 11 | + * @return void |
|
| 12 | + */ |
|
| 13 | + public function up() |
|
| 14 | + { |
|
| 15 | + Schema::create('permissions', function (Blueprint $table) { |
|
| 16 | + $table->increments('id'); |
|
| 17 | + $table->string('name', 100); |
|
| 18 | + $table->string('model', 100); |
|
| 19 | + $table->softDeletes(); |
|
| 20 | + $table->timestamps(); |
|
| 21 | + $table->unique(array('name', 'model')); |
|
| 22 | + }); |
|
| 23 | + Schema::create('permission_role', function (Blueprint $table) { |
|
| 24 | + $table->increments('id'); |
|
| 25 | + $table->unsignedInteger('role_id'); |
|
| 26 | + $table->unsignedInteger('permission_id'); |
|
| 27 | + $table->softDeletes(); |
|
| 28 | + $table->timestamps(); |
|
| 29 | 29 | |
| 30 | - $table->foreign('role_id')->references('id')->on('roles'); |
|
| 31 | - $table->foreign('permission_id')->references('id')->on('permissions'); |
|
| 32 | - }); |
|
| 33 | - } |
|
| 30 | + $table->foreign('role_id')->references('id')->on('roles'); |
|
| 31 | + $table->foreign('permission_id')->references('id')->on('permissions'); |
|
| 32 | + }); |
|
| 33 | + } |
|
| 34 | 34 | |
| 35 | - /** |
|
| 36 | - * Reverse the migrations. |
|
| 37 | - * |
|
| 38 | - * @return void |
|
| 39 | - */ |
|
| 40 | - public function down() |
|
| 41 | - { |
|
| 42 | - Schema::dropIfExists('permission_role'); |
|
| 43 | - Schema::dropIfExists('permissions'); |
|
| 44 | - } |
|
| 35 | + /** |
|
| 36 | + * Reverse the migrations. |
|
| 37 | + * |
|
| 38 | + * @return void |
|
| 39 | + */ |
|
| 40 | + public function down() |
|
| 41 | + { |
|
| 42 | + Schema::dropIfExists('permission_role'); |
|
| 43 | + Schema::dropIfExists('permissions'); |
|
| 44 | + } |
|
| 45 | 45 | } |