kurenai
kurenai copied to clipboard
Support for Laravel blade templates
Have you considered writing an extended Laravel ViewFactory, that would first parse all blade templates for metadata before handing the content back to Laravel for normal handling?
I can think of a number of cases where I might want to allow views to offer up some config, and access that in the controller.
public function myControllerFunction()
{
$view = view('my.page');
if($view->getMetadata()['foo'] == 'bar') {
doSomething();
}
return $view;
}
my/page.blade.php:
{
"foo": "bar"
}
===
@extends('layouts.main')
@section('content')
The rest of my normal blade template
@endsection