Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to pass variable to @extends blade

I have variable {{$template}}.. How can I do for including that variable to @extends. I had try like this:

@extends({{$template}}) // getting error

I hope, there is one answer to help me. Thanks.

like image 770
Wahyu Kodar Avatar asked Dec 11 '22 20:12

Wahyu Kodar


1 Answers

you mean you want to pass the value for $template to your layout? and from where you are getting the value of $template?

If you want to pass the variable to layout, then try doing

@extends('<<your layout name>>', ['template' => $template])
like image 94
Sid Avatar answered Dec 20 '22 22:12

Sid