Push to stack
March 8, 2017 ยท View on GitHub
Pragmatically push content to a stack inside blade views.
How this works
todo...
Example
layout.blade.php
<html>
<head>
@stack('head')
</head>
<body>
@section('body')
@stack('scripts')
</body>
</html>
Somewhere in your PHP Code (a Service Provider boot method, a Controller method, whatever)
$be = app('blade-extensions');
$be->pushToStack('scripts', 'layout', '<script src="' . asset('my-script.js') . '">');
Parameters
| Parameter | Type | Description |
|---|---|---|
| $stackName | string | The name of the stack |
| $targetViews | `string | string[]` |
| $content | `string | Closure` |