Exemplo n.º 1
0
 public function getExtraProperties($slug, $id = null)
 {
     switch ($slug) {
         case 'auto':
             if ($id != null) {
                 $ad = Ad::with(['auto_properties.auto_model.parent', 'category.parent'])->findOrFail($id);
             }
             // todo: wtf?
             $data = ['models' => AutoModel::where('make_id', null)->get()];
             if (isset($ad)) {
                 $data['ad'] = $ad;
             }
             return view('sub.autoExtraProperties', $data);
             break;
         case 'realty':
             if ($id != null) {
                 $ad = Ad::with(['category.parent', 'realty_properties'])->findOrFail($id);
             }
             return view('sub.realtyExtraProperties', ['category' => Request::input('category'), 'ad' => isset($ad) ? $ad : null]);
             break;
     }
 }