public function getIndex()
 {
     $types = array();
     foreach (CarType::all() as $type) {
         $types[$type->id] = $type->name;
     }
     $transmission = array(1 => 'Automatic', 0 => 'Manual');
     $aircon = array(1 => 'Yes', 0 => 'No');
     $seats = array(2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6, 7 => 7, 8 => 8, 9 => 9);
     $doors = array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 6 => 6);
     return View::make('cars.index')->with('cars', Car::with('carType')->get())->with('car_types', $types)->with('available_at', date("Y-m-d"))->with('transmission', $transmission)->with('aircon', $aircon)->with('seats', $seats)->with('doors', $doors);
 }
Esempio n. 2
0
 public function testChainedAdterHas_Many_Through()
 {
     $car = Car::with(array('parts' => array('with' => 'cars')))->find_one(1);
     $test_exists = $car->as_array();
     $test_exists = $car->parts->as_array();
     foreach ($car->parts as $part) {
         foreach ($part->cars as $car) {
             $test_exists = $car->as_array();
         }
     }
     // NO FATAL ERRORS OR EXCEPTIONS THROW
     $this->assertInstanceOf('Granada\\Model', $car);
 }
Esempio n. 3
0
 public function testCallStaticForModel()
 {
     $expected = Model::factory('Car')->with('manufactor')->find_one(1);
     $car = Car::with('manufactor')->find_one(1);
     $this->assertEquals($expected, $car, 'Call from static and from factory are the same');
 }