I want to define factory with position
field = id
value. Is it possible?
For example:
$factory->define(App\Models\Category::class, function (Faker\Generator $faker) {
return [
'name' => $faker->name,
'display' => 1,
'position' => function (array $category) {
return $category['id'];
},
];
});
via Evgeniy