public function courses() { $productTag = Input::get('tag'); return view('home.courses.index', ['courses' => $productTag != null ? Course::whereHas('productTags', function ($query) use($productTag) { $query->where('name', $productTag); })->get() : Course::all()]); }
/** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { return view('admin.courses.index', ['courses' => Course::all()]); }