automobile = $automobile; $this->accessory = $accessory; $this->directory = $directory; $this->make = $make; $this->car_model = $car_model; } /** * Returns count of automobile. * * @param array $filter * * @return int */ public function count() { return 0; } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.automobile.gadget', $count = 10) { if (User::hasRole('user')) { $this->automobile->pushCriteria(new \Litepie\Laraauto\Repositories\Criteria\AutomobileUserCriteria()); } $automobile = $this->automobile->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('automobile::' . $view, compact('automobile'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.accessory.gadget', $count = 10) { if (User::hasRole('user')) { $this->accessory->pushCriteria(new \Litepie\Laraauto\Repositories\Criteria\AccessoryUserCriteria()); } $accessory = $this->accessory->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('automobile::' . $view, compact('accessory'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.directory.gadget', $count = 10) { if (User::hasRole('user')) { $this->directory->pushCriteria(new \Litepie\Laraauto\Repositories\Criteria\DirectoryUserCriteria()); } $directory = $this->directory->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('automobile::' . $view, compact('directory'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.make.gadget', $count = 10) { if (User::hasRole('user')) { $this->make->pushCriteria(new \Litepie\Laraauto\Repositories\Criteria\MakeUserCriteria()); } $make = $this->make->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('automobile::' . $view, compact('make'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.car_model.gadget', $count = 10) { if (User::hasRole('user')) { $this->car_model->pushCriteria(new \Litepie\Laraauto\Repositories\Criteria\CarModelUserCriteria()); } $car_model = $this->car_model->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('automobile::' . $view, compact('car_model'))->render(); } }