Reputation: 61
I m trying to assign multiple variable to the blade template but it returns an exception
Undefined variable: transactions (View: /home/u305199682/public_html/dash/protected/app/views/pages/template/home.blade.php)
$this->layout->nest('content',$page)
->with(array(
'menus' => $this->menus,
'transactions' => $transaction
)
);
Upvotes: 0
Views: 458
Reputation: 800
You need to call with for each variable
$this
->layout
->nest('content',$page)
->with('menus',$this->menus)
->with("transactions",$transaction);
or put both variables into 1 array.
$passVar = array(
'menus' => $this->menus,
'transaction' => $transaction
);
$this
->layout
->nest('content',$page, $passVar);
Upvotes: 0
Reputation: 4059
if you wanna pass data to a nested view, try
$this->layout->nest('content', $page, array(
'menus' => $this->menus,
'transactions' => $transaction
));
Upvotes: 1