database/factories/BookFactory.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 [
            'name' => $name = $this->faker->sentence,
            'slug' => Str::slug($name),
            'free' => rand(0, 1),
            'difficulty' => ['beginner', 'intermediate', 'advanced'][rand(0, 2)],
            'type' => ['theory', 'project', 'snippet'][rand(0, 2)],
            'views' => $this->faker->numberBetween(1, 20),
        ];
    }
public function definition ( ) { return [ 'name' => $ name = $ this -> faker -> sentence , 'slug' => Str :: slug ( $ name ) , 'free' => rand ( 0 , 1 ) , 'difficulty' => [ 'beginner' , 'intermediate' , 'advanced' ] [ rand ( 0 , 2 ) ] , 'type' => [ 'theory' , 'project' , 'snippet' ] [ rand ( 0 , 2 ) ] , 'views' => $ this -> faker -> numberBetween ( 1 , 20 ) , ] ; }
Define the model's default state.
Define the model ' s default state .