kurenai icon indicating copy to clipboard operation
kurenai copied to clipboard

Support for Laravel blade templates

Open jszobody opened this issue 9 years ago • 0 comments

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

jszobody avatar Feb 16 '16 14:02 jszobody