/** * @param string $hash * @return UserModel */ public function getByHash($hash) { if ($hash instanceof UserModel) { return $hash; } return parent::getByHash($hash); }
public function __construct(NotificationModel $containerModel) { $this->model = $containerModel; parent::__construct($containerModel); }
/** * @param $identifier * @param array $attributes Update attributes * @return \stdClass Updated project model */ public function update($identifier, array $attributes) { $model = $this->getByHash($identifier); if ($attributes['status'] == 1) { //ignore submission if already submitted. For the case where state returns to status 1 if ($model->submitted_at != null) { unset($attributes['submitted_at']); } } else { if ($attributes['status'] == 2) { //ignore review if already reviewed. For the case where the state returns to status 2 if ($model->reviewed_on != null) { unset($attributes['reviewed_on']); } } } $updated = parent::update($model->id, $attributes); return $updated; }
/** * @param $key * @param $value * @param Repository $transform * @return \stdClass */ protected function transformByRepository($key, $value, EloquentRepository $transform) { try { $value = $transform->getByHash($value); $this->keys[$key] = $value; } catch (NotFoundModelException $e) { throw new BadRequestHttpException("{$value} not found."); } return $value; }
public function __construct(UploadModel $model) { $this->model = $model; parent::__construct($model); }
public function __construct(Model $model) { parent::__construct($model); }
public function __construct(ActivityModel $model) { $this->model = $model; parent::__construct($model); }