shipping_method = $shipping_method; $this->pincode = $pincode; $this->country = $country; $this->state = $state; } /** * Returns count of shipping. * * @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.shipping_method.gadget', $count = 10) { if (User::hasRole('user')) { $this->shipping_method->pushCriteria(new \Litepie\Shopping\Repositories\Criteria\ShippingMethodUserCriteria()); } $shipping_method = $this->shipping_method->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('shipping::' . $view, compact('shipping_method'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.pincode.gadget', $count = 10) { if (User::hasRole('user')) { $this->pincode->pushCriteria(new \Litepie\Shopping\Repositories\Criteria\PincodeUserCriteria()); } $pincode = $this->pincode->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('shipping::' . $view, compact('pincode'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.country.gadget', $count = 10) { if (User::hasRole('user')) { $this->country->pushCriteria(new \Litepie\Shopping\Repositories\Criteria\CountryUserCriteria()); } $country = $this->country->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('shipping::' . $view, compact('country'))->render(); } /** * Make gadget View * * @param string $view * * @param int $count * * @return View */ public function gadget($view = 'admin.state.gadget', $count = 10) { if (User::hasRole('user')) { $this->state->pushCriteria(new \Litepie\Shopping\Repositories\Criteria\StateUserCriteria()); } $state = $this->state->scopeQuery(function ($query) use ($count) { return $query->orderBy('id', 'DESC')->take($count); })->all(); return view('shipping::' . $view, compact('state'))->render(); } }