database/factories/TopicFactory.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()
    {
        return [
            'title' => $this->faker->title(),
            'content' => $this->faker->text(),
            'user_id' => DB::table('users')->inRandomOrder()->first()->id,
            'category_id' => DB::table('categories')->inRandomOrder()->first()->id,
        ];
    }
public function definition ( ) { return [ 'title' => $ this -> faker -> title ( ) , 'content' => $ this -> faker -> text ( ) , 'user_id' => DB :: table ( 'users' ) -> inRandomOrder ( ) -> first ( ) -> id , 'category_id' => DB :: table ( 'categories' ) -> inRandomOrder ( ) -> first ( ) -> id , ] ; }
Define the model's default state.
Define the model ' s default state .