first change
This commit is contained in:
0
Modules/Employee/database/factories/.gitkeep
Normal file
0
Modules/Employee/database/factories/.gitkeep
Normal file
34
Modules/Employee/database/factories/DepartmentFactory.php
Normal file
34
Modules/Employee/database/factories/DepartmentFactory.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Employee\Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DepartmentFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*/
|
||||
protected $model = \Modules\Employee\Models\Department::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
static $order = 1;
|
||||
$title = $this->faker->firstName();
|
||||
|
||||
return [
|
||||
'title' => $title,
|
||||
'slug' => Str::slug($title),
|
||||
'status' => $this->faker->randomElement([0, 1]),
|
||||
'order' => $order++,
|
||||
'user_id' => 1,
|
||||
'createdby' => 1,
|
||||
'updatedby' => 1,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
34
Modules/Employee/database/factories/DesignationFactory.php
Normal file
34
Modules/Employee/database/factories/DesignationFactory.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Employee\Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
class DesignationFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*/
|
||||
protected $model = \Modules\Employee\Models\Designation::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
static $order = 1;
|
||||
$title = $this->faker->firstName();
|
||||
|
||||
return [
|
||||
'title' => $title,
|
||||
'slug' => Str::slug($title),
|
||||
'status' => $this->faker->randomElement([0, 1]),
|
||||
'order' => $order++,
|
||||
'department_id' => 1,
|
||||
'createdby' => 1,
|
||||
'updatedby' => 1,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
45
Modules/Employee/database/factories/EmployeeFactory.php
Normal file
45
Modules/Employee/database/factories/EmployeeFactory.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Employee\Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Modules\Employee\Models\Employee;
|
||||
|
||||
class EmployeeFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The name of the factory's corresponding model.
|
||||
*/
|
||||
protected $model = Employee::class;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'first_name' => $this->faker->firstName,
|
||||
'middle_name' => $this->faker->firstName,
|
||||
'last_name' => $this->faker->lastName,
|
||||
'dob' => $this->faker->date(),
|
||||
'email' => $this->faker->unique()->safeEmail,
|
||||
'contact' => $this->faker->phoneNumber,
|
||||
'mobile' => $this->faker->phoneNumber,
|
||||
'photo' => $this->faker->imageUrl(),
|
||||
'guardian_name' => $this->faker->name,
|
||||
'guardian_contact' => $this->faker->phoneNumber,
|
||||
'temporary_address' => $this->faker->address,
|
||||
'permanent_address' => $this->faker->address,
|
||||
'employee_code' => $this->faker->unique()->numberBetween(1000, 9999),
|
||||
'join_date' => $this->faker->date(),
|
||||
'gender_id' => $this->faker->randomElement([1, 2]),
|
||||
'designation_id' => $this->faker->randomElement([1, 2, 3, 4]),
|
||||
'department_id' => $this->faker->randomElement([1, 2, 3]),
|
||||
'branch_id' => $this->faker->randomElement([1, 2, 3]),
|
||||
'user_id' => $this->faker->randomElement([1, 2, 3]),
|
||||
'status' => $this->faker->randomElement([1, 0]),
|
||||
'remarks' => $this->faker->sentence,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user