I have tried a few things to try to get this to work. I was looking at this --
Laravel Blade - pass variable via an @include or @yield -- question about how to pass variables between blades but I can't seem to get it to work!
I have a view calling my header view (in /resources/views/layouts/frontendbasic.blade.php):
@include('common/head', array('url'=>'www.url.com'))
And in the header blade (in /resources/views/common/head.blade.php) I am calling that variable like this:
<meta property="og:url" content="{{ $url }}" />
And I get the error:
Undefined variable: url
(View: ...\resources\views\common\head.blade.php)
(View: ...\resources\views\common\head.blade.php)
(View: ...\resources\views\common\head.blade.php)
I am wondering what I am doing wrong?
Caio Kawasaki :
The correct thing is to pass a variable through the controller:\n\nreturn view('view.path', [\n 'url' => 'www.url.com'\n]);\n\n\nhowever, try as below:\n\n@include('common.head', ['url' => 'www.url.com'])\n",
2018-03-14T23:28:52