63 lines
1.5 KiB
PHP
63 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
use Illuminate\Database\Seeder;
|
|
use Modules\Admin\Models\Department;
|
|
use Modules\Admin\Models\Designation;
|
|
|
|
class DesignationSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
$designations = [
|
|
|
|
[
|
|
'name' => "Manager",
|
|
'department_name' => 'HR'
|
|
],
|
|
[
|
|
'name' => "Analyst",
|
|
'department_name' => 'Marketing'
|
|
],
|
|
[
|
|
'name' => "HR Specialist",
|
|
'department_name' => 'HR'
|
|
],
|
|
[
|
|
'name' => "Sales Representative",
|
|
'department_name' => "Marketing"
|
|
],
|
|
[
|
|
'name' => "Full Stack",
|
|
'department_name' => "IT"
|
|
],
|
|
|
|
[
|
|
'name' => "Backend",
|
|
'department_name' => "IT"
|
|
],
|
|
];
|
|
|
|
foreach ($designations as $designation) {
|
|
|
|
$department = Department::where('name', $designation['department_name'])->first();
|
|
|
|
if ($department) {
|
|
|
|
$designationData = [
|
|
'department_id' => $department->department_id,
|
|
'name' => $designation['name']
|
|
];
|
|
}
|
|
|
|
Designation::create($designationData);
|
|
}
|
|
|
|
}
|
|
}
|