Conditions | 1 |
Paths | 1 |
Total Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
11 | public static function create($content, String $label = null, int $page_id = null): BlockTypeAbstract |
||
12 | { |
||
13 | $blockClass = \get_class(); |
||
14 | |||
15 | $block = Block::firstOrCreate(['type' => self::$blockType, 'label' => $label]); |
||
16 | |||
17 | $blockContent = $block->blockContents()->create([ |
||
18 | 'block_id' => $block->id, |
||
19 | 'page_id' => $page_id, |
||
20 | 'content' => $content, |
||
21 | ]); |
||
22 | |||
23 | return new $blockClass($block, $blockContent, $page_id); |
||
24 | } |
||
25 | } |
||
26 |