*/ class ProjectFactory extends Factory { /** * Define the model's default state. * * @return array */ public function definition() { $name = fake()->country(); $client = Client::factory('App\Models\Client')->create(); return [ 'client_id' => $client->id, 'name' => 'Project ' . $name, 'code' => strtoupper(substr($name, 0, 3)) . '-2023-' . rand(1, 9), ]; } }