namespace App\Http\Controllers;
use App\Models\Page;
use VanOns\Laraberg\Blocks\BlockParser;
class HomeController extends Controller
{
//
public function index(BlockParser $parser)
{
$page = Page::where('slug', 'home')->firstOrFail();
$blocks = $parser->parse($page->content);
$output = '';
foreach ($blocks as $block) {
$output .= $block->render();
}
$page->content = $output;
return view('home', ['page' => $page]);
}
}