- Timestamp:
- 10/13/21 15:44:57 (3 years ago)
- Branches:
- develop, master
- Children:
- 120759b
- Parents:
- 194a359
- Location:
- database
- Files:
-
- 5 added
- 1 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
database/migrations/2021_09_27_171107_create_users_table.php
r194a359 r24a616f 23 23 $table->string('email')->unique(); 24 24 $table->string('mobile_number')->unique(); 25 $table->string('avatar')->nullable(); 25 26 $table->integer('role_id')->unsigned(); 26 27 $table->foreign("role_id")->references("id")->on("roles"); -
database/migrations/2021_09_29_121244_create_departments_table.php
r194a359 r24a616f 19 19 $table->string("name"); 20 20 $table->string("code"); 21 $table->string("location"); 21 22 $table->timestamps(); 22 23 -
database/seeders/DatabaseSeeder.php
r194a359 r24a616f 19 19 $this->call(UsersTableSeeder::class); 20 20 $this->call(DepartmentsTableSeeder::class); 21 $this->call(DocumentsTableSeeder::class); 21 22 } 22 23 } -
database/seeders/DepartmentsTableSeeder.php
r194a359 r24a616f 3 3 namespace Database\Seeders; 4 4 5 use App\Models\Department; 5 6 use Carbon\Carbon; 6 7 use Illuminate\Database\Seeder; … … 15 16 public function run() 16 17 { 17 \DB::table('departments')->insert([ 18 [ 19 "name" => "HR department", 20 "code" => "14", 21 "user_id" => "1", 22 "created_at" => Carbon::now()->format('Y-m-d H:i:s'), 23 ], 24 [ 25 "name" => "IT department", 26 "code" => "01", 27 "user_id" => "1", 28 "created_at" => Carbon::now()->format('Y-m-d H:i:s'), 29 ], 30 [ 31 "name" => "Business department", 32 "code" => "12", 33 "user_id" => "1", 34 "created_at" => Carbon::now()->format('Y-m-d H:i:s'), 35 ], 36 ]); 18 // \DB::table('departments')->insert([ 19 // [ 20 // "name" => "HR department", 21 // "code" => "14", 22 // "location" => "C:\laragon\www\SaveSpace\storage/Departments/14", 23 // "user_id" => "1", 24 // "created_at" => Carbon::now()->format('Y-m-d H:i:s'), 25 // ], 26 // [ 27 // "name" => "IT department", 28 // "code" => "01", 29 // "location" => "C:\laragon\www\SaveSpace\storage/Departments/01", 30 // "user_id" => "1", 31 // "created_at" => Carbon::now()->format('Y-m-d H:i:s'), 32 // ], 33 // [ 34 // "name" => "Business department", 35 // "code" => "12", 36 // "location" => "C:\laragon\www\SaveSpace\storage/Departments/12", 37 // "user_id" => "1", 38 // "created_at" => Carbon::now()->format('Y-m-d H:i:s'), 39 // ], 40 // ]); 41 42 Department::factory()->count(50)->create(); 37 43 } 38 44 } -
database/seeders/PermissionsTableSeeder.php
r194a359 r24a616f 18 18 \DB::table('permissions')->insert([ 19 19 ["name" => "create_user"], // Create new user 20 ["name" => "access_all_users"], // Access to all users to manage 21 ["name" => "access_all_departments"], // Access to all departments to manage 20 ["name" => "manage_all_users"], // Access all users to manage 21 ["name" => "manage_all_departments"], // Access all departments to manage 22 ["name" => "manage_all_documents"], // Access all documents to manage 23 ["name" => "view_all_departments"], // Access all departments to view 24 ["name" => "view_all_documents"], // Access all documents to view 25 ["name" => "edit_all_documents"], // Edit all documents 26 ["name" => "edit_document"], // Edit your document/s 27 ["name" => "delete_all_documents"], // Delete all document/s 28 ["name" => "delete_document"], // Delete your document/s 22 29 ]); 23 30 } -
database/seeders/RolesPermissionsTableSeeder.php
r194a359 r24a616f 19 19 ["role_id" => 1, "permission_id" => 2], 20 20 ["role_id" => 1, "permission_id" => 3], 21 ["role_id" => 1, "permission_id" => 4], 22 ["role_id" => 1, "permission_id" => 5], 23 ["role_id" => 1, "permission_id" => 6], 24 ["role_id" => 1, "permission_id" => 7], 25 ["role_id" => 1, "permission_id" => 8], 26 ["role_id" => 1, "permission_id" => 9], 27 ["role_id" => 1, "permission_id" => 10], 21 28 22 29 // Referent 23 ["role_id" => 2, "permission_id" => 3] 30 ["role_id" => 2, "permission_id" => 3], 31 ["role_id" => 2, "permission_id" => 4], 32 ["role_id" => 2, "permission_id" => 5], 33 ["role_id" => 2, "permission_id" => 6], 34 ["role_id" => 2, "permission_id" => 7], 35 ["role_id" => 2, "permission_id" => 8], 36 ["role_id" => 2, "permission_id" => 9], 37 ["role_id" => 2, "permission_id" => 10], 38 39 // Viewer 40 ["role_id" => 3, "permission_id" => 5], 41 ["role_id" => 3, "permission_id" => 6], 24 42 ]); 25 43 } -
database/seeders/RolesTableSeeder.php
r194a359 r24a616f 16 16 \DB::table('roles')->insert([ 17 17 ["name" => "Admin"], // Have access to all users(managing users), departments, documents etc 18 ["name" => "Referent"], // Have access to all departments, documents etc 18 ["name" => "Referent"], // Have access to manage and view all departments, documents etc 19 ["name" => "Viewer"], // Have access to view all departments, documents etc 19 20 ]); 20 21 } -
database/seeders/UsersTableSeeder.php
r194a359 r24a616f 41 41 ]); 42 42 43 //factory(App\Models\User::class, 50)->create();44 43 } 45 44 }
Note:
See TracChangeset
for help on using the changeset viewer.