示例#1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $vehicles = Vehicle::all();
     // $arrPromos = $this->aggregatePromoDataFromWeb();
     foreach ($vehicles as $vehicle) {
         $danawa_id = $vehicle->danawa_id;
         $brand = $vehicle->brand->brand_code;
         $model = $vehicle->name;
         $this->aggregateTrimData($danawa_id, $brand, $model);
         $this->info('Processing ' . $brand . "\n");
     }
 }
 public function testDelete()
 {
     $idDelete = Vehicle::all()->last()['id'];
     factory(\App\Entities\Entry::class)->create(['vehicle_id' => $idDelete]);
     $this->seeInDatabase('vehicles', ['id' => $idDelete]);
     $this->visit('/vehicle/destroy/' . $idDelete)->seePageIs('/vehicle')->see('Este registro possui refer');
     $this->seeIsNotSoftDeletedInDatabase('vehicles', ['id' => $idDelete]);
     $vehicle = Vehicle::find($idDelete);
     $vehicle->entries()->delete();
     $vehicle->trips()->delete();
     $this->seeInDatabase('vehicles', ['id' => $idDelete]);
     $this->visit('/vehicle/destroy/' . $idDelete);
     $this->seeIsSoftDeletedInDatabase('vehicles', ['id' => $idDelete]);
 }
 public function testDeleteExecutive()
 {
     $this->get('/vehicle/destroy/' . Vehicle::all()->last()['id'])->assertResponseStatus(302);
 }