You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
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.
my/page.blade.php
:The text was updated successfully, but these errors were encountered: