database/factories/ContentFactory.php
/**
     * Define the model's default state.
     *
     * @return array
     */
Define the model's default state.
@return array
Define the model ' s default state . @return array
public function definition()
    {
        $user = User::factory()->create();
        $date = $this->faker->dateTimeThisMonth();
        $type = $this->faker->randomElement([
            "general",
            "buysell",
            "expats",
            "misc",
        ]);
        return [
            "title" => $this->faker->sentence(),
            "user_id" => $user,
            "body" => $this->faker->paragraphs(2, true),
            "type" => $type,
            "created_at" => $date,
            "updated_at" => $date,
        ];
    }
public function definition ( ) { $ user = User :: factory ( ) -> create ( ) ; $ date = $ this -> faker -> dateTimeThisMonth ( ) ; $ type = $ this -> faker -> randomElement ( [ " general " , " buysell " , " expats " , " misc " , ] ) ; return [ " title " => $ this -> faker -> sentence ( ) , " user_id " => $ user , " body " => $ this -> faker -> paragraphs ( 2 , true ) , " type " => $ type , " created_at " => $ date , " updated_at " => $ date , ] ; }
Define the model's default state.
Define the model ' s default state .