nhayder
229
3
Laravel

Passing multiple data to blade template

Posted 1 month ago by nhayder

Hi, i have this multiple eloquent query

return view('public.welcome', compact('page', 'topMenu', 'theme', 'copyright', 'pageManager', 'activeLanguages', 'pageWidget', $slug));

i'm passing theme + page from that query to blade template

@extends('layouts.theme', ['theme' => $theme, 'page' => $page])

But data are not getting passed i'm getting this error instead

Undefined variable: page (View: /Applications/MAMP/htdocs/blog/resources/views/public/welcome.blade.php)

so what is the proper way to pass the theme and page to main blade template

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.