コード例 #1
0
ファイル: Provider.php プロジェクト: robbytaylor/boom-core
 public function create(Page $page, $attrs)
 {
     $version = $page->addVersion();
     $attrs['page_vid'] = $version->getId();
     $attrs['page_id'] = $page->getId();
     $type = $attrs['type'];
     unset($attrs['type']);
     $modelName = 'BoomCMS\\Database\\Models\\Chunk\\' . ucfirst($type);
     $model = $modelName::create($attrs);
     $className = 'BoomCMS\\Core\\Chunk\\' . ucfirst($type);
     $attrs['id'] = $model->id;
     return new $className($page, $attrs, $attrs['slotname'], true);
 }
コード例 #2
0
ファイル: Provider.php プロジェクト: boomcms/boom-core
 public function create(Page $page, $attrs)
 {
     $version = $page->addVersion();
     $attrs['page_vid'] = $version->getId();
     $attrs['page_id'] = $page->getId();
     $type = $attrs['type'];
     unset($attrs['type']);
     $modelName = $this->getModelName($type);
     $model = $modelName::create($attrs);
     $this->saveToCache($type, $attrs['slotname'], $version, $model);
     $className = $this->getClassName($type);
     $attrs['id'] = $model->id;
     $version->{VersionModel::ATTR_CHUNK_TYPE} = $type;
     $version->{VersionModel::ATTR_CHUNK_ID} = $model->id;
     $version->save();
     return new $className($page, $attrs, $attrs['slotname'], true);
 }