PermissionsTableSeeder.php 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. <?php
  2. use Illuminate\Database\Seeder;
  3. use Illuminate\Support\Facades\DB;
  4. class PermissionsTableSeeder extends Seeder
  5. {
  6. /**
  7. * Run the database seeds.
  8. *
  9. * @return void
  10. */
  11. public function run()
  12. {
  13. DB::table('permissions')->insert([
  14. [
  15. 'name' => 'admins',
  16. 'display_name' => 'Admins',
  17. 'parent' => 0,
  18. 'guard_name' => 'admin'
  19. ],[
  20. 'name' => 'role_&_permission',
  21. 'display_name' => 'Role & Permission',
  22. 'parent' => 0,
  23. 'guard_name' => 'admin'
  24. ],[
  25. 'name' => 'create',
  26. 'display_name' => 'Create',
  27. 'parent' => 1,
  28. 'guard_name' => 'admin'
  29. ],[
  30. 'name' => 'update',
  31. 'display_name' => 'Update',
  32. 'parent' => 1,
  33. 'guard_name' => 'admin'
  34. ],[
  35. 'name' => 'delete',
  36. 'display_name' => 'Delete',
  37. 'parent' => 1,
  38. 'guard_name' => 'admin'
  39. ],[
  40. 'name' => 'roles',
  41. 'display_name' => 'Roles',
  42. 'parent' => 2,
  43. 'guard_name' => 'admin'
  44. ],[
  45. 'name' => 'permissions',
  46. 'display_name' => 'Permissions',
  47. 'parent' => 2,
  48. 'guard_name' => 'admin'
  49. ]
  50. ]);
  51. DB::table('roles')->insert([
  52. [
  53. 'name' => 'Super-Admin',
  54. 'guard_name' => 'admin'
  55. ]
  56. ]);
  57. DB::table('role_has_permissions')->insert([
  58. [
  59. 'permission_id' => 1,
  60. 'role_id' => 1
  61. ],[
  62. 'permission_id' => 2,
  63. 'role_id' => 1
  64. ],[
  65. 'permission_id' => 3,
  66. 'role_id' => 1
  67. ],[
  68. 'permission_id' => 4,
  69. 'role_id' => 1
  70. ],[
  71. 'permission_id' => 5,
  72. 'role_id' => 1
  73. ],[
  74. 'permission_id' => 6,
  75. 'role_id' => 1
  76. ],[
  77. 'permission_id' => 7,
  78. 'role_id' => 1
  79. ]
  80. ]);
  81. DB::table('model_has_roles')->insert([
  82. [
  83. 'role_id' => 1,
  84. 'model_type' => 'App\Models\Admin',
  85. 'model_id' => 1
  86. ]
  87. ]);
  88. }
  89. }