/** * Search the metadata table data associated with the given model. * Assigns a new attribute inside of the model - 'meta'. * @return MetaCollection */ public static function retrieve(Model $model) { if ($model->meta) { return $model->meta; } // Object can either be the UID or the model class. // Model class tends to be global for all of that model. // However, UID keys will override class keys. return static::where('object', $model->getAttribute('uid'))->orWhere('object', get_class($model))->get(); }
/** * Return the inputs for the given model. * Looks for model class and model uid as the 'object' field. * @param $model Model * @return mixed */ public static function retrieve(Model $model) { if (!empty($model->inputs)) { return $model->inputs; } $inputs = static::where('object', $model->getAttribute('uid'))->orWhere('object', get_class($model))->orderBy('priority', 'asc')->get(); $inputs->setParent($model); return $inputs; }