public function set_id($value) { if (is_object($value) && $value instanceof Id) { $this->id = $value; } else { $this->id = Id::create($value); } }
/** * Create a new middleware instance. * * @param Guard $auth * @return void */ public function __construct(StoreRepository $storeRepository) { $this->storeRepository = $storeRepository; if (\Session::has('currentStoreID')) { $currentStoreID = Id::create(\Session::get('currentStoreID')); $this->currentStore = $this->storeRepository->findOneById($currentStoreID); } else { $this->currentStore = null; } }
public function loadAttributeSet($setID) { $attributeSetID = Id::create($setID); if (!$attributeSetID->value()) { \App::abort(404); } $attributeSetDO = $this->attributeSetRepository->findOneById($attributeSetID); if (!$attributeSetDO) { \App::abort(404); } return $attributeSetDO; }
/** * Bind data to the view. * * @param View $view * @return void */ public function compose(View $view) { $list = array(); $user = $this->auth->user(); if ($user) { $stores = $this->storeRepository->findByUserId(Id::create($user->id)); foreach ($stores as $store) { $list[$store->id->value()] = $store->label; } } $view->with('accessibleStoresDropdownOptions', $list); }
/** * Define your route model bindings, pattern filters, etc. * * @param \Illuminate\Routing\Router $router * @return void */ public function boot(Router $router) { parent::boot($router); $router->bind('id', function ($value) { $id = Id::create($value); return $id; }); $router->bind('page_id', function ($value) { $id = Id::create($value); return $id; }); $router->bind('store_id', function ($value) { $id = Id::create($value); return $id; }); $router->bind('store_view_id', function ($value) { $id = Id::create($value); return $id; }); $router->bind('user_id', function ($value) { $id = Id::create($value); return $id; }); $router->bind('product_id', function ($value) { $id = Id::create($value); return $id; }); $router->bind('attribute_set_id', function ($value) { $id = Id::create($value); return $id; }); $router->bind('attribute_id', function ($value) { $id = Id::create($value); return $id; }); }
public function findOneById(Id $id) { $entity = $this->model->find($id->value()); return $this->buildOne($entity); }
public function set_id($data) { $this->id = Id::create($data); }