Changeset 24a616f for database/seeders


Ignore:
Timestamp:
10/13/21 15:44:57 (3 years ago)
Author:
Berat Kjufliju <kufliju@…>
Branches:
develop, master
Children:
120759b
Parents:
194a359
Message:

added documents crud, added last_seen_to_user, edited views

Location:
database/seeders
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • database/seeders/DatabaseSeeder.php

    r194a359 r24a616f  
    1919        $this->call(UsersTableSeeder::class);
    2020        $this->call(DepartmentsTableSeeder::class);
     21        $this->call(DocumentsTableSeeder::class);
    2122    }
    2223}
  • database/seeders/DepartmentsTableSeeder.php

    r194a359 r24a616f  
    33namespace Database\Seeders;
    44
     5use App\Models\Department;
    56use Carbon\Carbon;
    67use Illuminate\Database\Seeder;
     
    1516    public function run()
    1617    {
    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();
    3743    }
    3844}
  • database/seeders/PermissionsTableSeeder.php

    r194a359 r24a616f  
    1818        \DB::table('permissions')->insert([
    1919            ["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
    2229        ]);
    2330    }
  • database/seeders/RolesPermissionsTableSeeder.php

    r194a359 r24a616f  
    1919            ["role_id" => 1, "permission_id" => 2],
    2020            ["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],
    2128
    2229            // 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],
    2442        ]);
    2543    }
  • database/seeders/RolesTableSeeder.php

    r194a359 r24a616f  
    1616        \DB::table('roles')->insert([
    1717            ["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
    1920        ]);
    2021    }
  • database/seeders/UsersTableSeeder.php

    r194a359 r24a616f  
    4141        ]);
    4242
    43         //factory(App\Models\User::class, 50)->create();
    4443    }
    4544}
Note: See TracChangeset for help on using the changeset viewer.