Skip to content

Commit e92a06d

Browse files
committed
Bugs in blocks
1 parent da5f142 commit e92a06d

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

src/Models/Block.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,16 @@ class Block extends Base
2121
'status',
2222
'body',
2323
];
24+
25+
public function render($name = null)
26+
{
27+
$args = func_get_args();
28+
$args[] = config('app.locale');
29+
30+
$block = $this->where('name', $name)
31+
->published()
32+
->first();
33+
34+
return $block !== null ? $block->present()->body : '';
35+
}
2436
}

src/Providers/ModuleProvider.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use Illuminate\Support\ServiceProvider;
88
use TypiCMS\Modules\Blocks\Composers\SidebarViewComposer;
99
use TypiCMS\Modules\Blocks\Facades\Blocks;
10+
use TypiCMS\Modules\Blocks\Models\Block;
1011

1112
class ModuleProvider extends ServiceProvider
1213
{

0 commit comments

Comments
 (0)