database/factories/EmployeeRideFactory.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()
    {
        $rides = Ride::all()->pluck('id');
        $conductors = User::role('conductor')->pluck('id');
        $drivers = User::role('driver')->pluck('id');
        return [
            'ride_code' => mt_rand(0000000000, 9999999999),
            'ride_id' => $rides->random(),
            'conductor_id' => $conductors->random(),
            'driver_id' => $drivers->random(),
            'travel_date' => $this->faker->dateTimeBetween('-3 months', 'now'),
        ];
    }
public function definition ( ) { $ rides = Ride :: all ( ) -> pluck ( 'id' ) ; $ conductors = User :: role ( 'conductor' ) -> pluck ( 'id' ) ; $ drivers = User :: role ( 'driver' ) -> pluck ( 'id' ) ; return [ 'ride_code' => mt_rand ( 0000000000 , 9999999999 ) , 'ride_id' => $ rides -> random ( ) , 'conductor_id' => $ conductors -> random ( ) , 'driver_id' => $ drivers -> random ( ) , 'travel_date' => $ this -> faker -> dateTimeBetween ( '-3 months' , 'now' ) , ] ; }
Define the model's default state.
Define the model ' s default state .