Server IP : 66.29.132.124 / Your IP : 3.15.229.217 Web Server : LiteSpeed System : Linux business141.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : wavevlvu ( 1524) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/wavevlvu/book24.ng/modules/Flight/Factories/ |
Upload File : |
<?php namespace Modules\Flight\Factories; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Facades\Log; use Modules\Flight\Models\Airline; use Modules\Flight\Models\Airport; use Modules\Flight\Models\Flight; class FlightFactory extends Factory { /** * The name of the factory's corresponding model. * * @var string */ protected $model = Flight::class; /** * Define the model's default state. * * @return array */ public function definition() { $departure_time = $this->faker->dateTimeBetween('+1 days','+7 days'); $duration = $this->faker->numberBetween(1,10); $airPort = Airport::pluck('id')->toArray(); $airLine = Airline::pluck('id')->toArray(); return [ 'title'=>$this->faker->name, 'code'=>'VJ'.$this->faker->numberBetween(100,1000), 'departure_time'=>$departure_time->format('Y-m-d H:i:s'), 'arrival_time'=>$departure_time->add(new \DateInterval("PT{$duration}H"))->format('Y-m-d H:i:s'), 'duration'=>$duration, 'airport_from'=>$this->faker->randomElement($airPort), 'airport_to'=>$this->faker->randomElement($airPort), 'airline_id'=>$this->faker->randomElement($airLine), 'status'=>'publish', ]; } }