remove compose file to another repo
This commit is contained in:
44
database/factories/CallFactory.php
Normal file
44
database/factories/CallFactory.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Category;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<\App\Models\Call>
|
||||
*/
|
||||
class CallFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'telephone_id' => $this->faker->numerify('tel-####'),
|
||||
'caller_phone_number' => '09' . $this->faker->unique()->randomNumber(9, true),
|
||||
'operator_id' => User::factory(),
|
||||
'operator_username' => function (array $attributes) {
|
||||
return User::find($attributes['operator_id'])->username;
|
||||
},
|
||||
'operator_full_name' => function (array $attributes) {
|
||||
return User::find($attributes['operator_id'])->full_name;
|
||||
},
|
||||
'description' => $this->faker->text,
|
||||
'category_id' => Category::factory(),
|
||||
'category_name' => function (array $attributes) {
|
||||
return Category::find($attributes['category_id'])->category_name;
|
||||
},
|
||||
'subcategory_id' => function (array $attributes) {
|
||||
return Category::find($attributes['category_id'])->subcategory_id;
|
||||
},
|
||||
'subcategory_name' => function (array $attributes) {
|
||||
return Category::find($attributes['category_id'])->subcategory_name;
|
||||
},
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user