public function postDestroy()
 {
     $type = CarType::find(Input::get('id'));
     if ($type) {
         $type->delete();
         return Redirect::to('admin/car_types/index')->with('message', 'Car Type Deleted');
     }
     return Redirect::to('admin/car_types/index')->with('message', 'Something went wrong, please try again');
 }
 public function getEdit($id)
 {
     $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.edit')->with('car', Car::find($id))->with('car_types', $types)->with('transmission', $transmission)->with('aircon', $aircon)->with('seats', $seats)->with('doors', $doors);
 }
 public function __construct()
 {
     $this->beforeFilter(function () {
         View::share('typenav', CarType::all());
     });
 }
 public function getCarType($type_id)
 {
     return View::make('store.car_type')->with('cars', Car::where('type_id', '=', $type_id)->orderBy('price')->paginate(3))->with('car_type', CarType::find($type_id));
 }