base commit
This commit is contained in:
commit
a794dacd39
345 files changed
+29597
No files matched your search
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Department;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DepartmentSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* @var array<string, array{name: string, code: string, description: string}>
|
||||
*/
|
||||
private const DEPARTMENTS = [
|
||||
'production' => [
|
||||
'name' => 'Production',
|
||||
'code' => 'PROD',
|
||||
'description' => 'Manufacturing and production operations.',
|
||||
],
|
||||
'warehouse' => [
|
||||
'name' => 'Warehouse',
|
||||
'code' => 'WH',
|
||||
'description' => 'Inventory and logistics.',
|
||||
],
|
||||
'administration' => [
|
||||
'name' => 'Administration',
|
||||
'code' => 'ADM',
|
||||
'description' => 'General administration and office management.',
|
||||
],
|
||||
'hr' => [
|
||||
'name' => 'HR',
|
||||
'code' => 'HR',
|
||||
'description' => 'Human resources and personnel management.',
|
||||
],
|
||||
'accounting' => [
|
||||
'name' => 'Accounting',
|
||||
'code' => 'ACC',
|
||||
'description' => 'Finance and accounting.',
|
||||
],
|
||||
];
|
||||
|
||||
public function run(): void
|
||||
{
|
||||
foreach (self::DEPARTMENTS as $department) {
|
||||
Department::query()->updateOrCreate(
|
||||
['code' => $department['code']],
|
||||
[
|
||||
'name' => $department['name'],
|
||||
'description' => $department['description'],
|
||||
'is_active' => true,
|
||||
],
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user