In this laravel getting started tutorial, I can see this writing: {code ...} the withPages () function is not rooted in laravel. I searched it on Google and did not find the answer. according to my guess, in my opinion, pages after withPages are mapped to the blade template... in this laravel getting started tutorial, I can see the following method:
withPages(Page::all()); }}
HereWithPages ()The function is not rooted in laravel. I searched it on Google and found no answer. according to my guess, in my opinion, pages after withPages are a data variable mapped to the blade template ($ pages). However, I can see that this method is not found in the laravel document.with('name', 'Victoria');In this way, which of the following friends knows what is going on? can you give me some information? Tell me what's going on? Very urgent.
Reply content:
In this laravel getting started tutorial, I can see the following method:
withPages(Page::all()); }}
HereWithPages ()The function is not rooted in laravel. I searched it on Google and found no answer. according to my guess, in my opinion, pages after withPages are a data variable mapped to the blade template ($ pages). However, I can see that this method is not found in the laravel document.with('name', 'Victoria');In this way, which of the following friends knows what is going on? can you give me some information? Tell me what's going on? Very urgent.
Dynamic View assignment!
The following are equivalent values:
view('home')->withPages(Page::all());view('home')->with('pages', Page:all());
In the previous chapter: Laravel 5 series Getting Started Tutorial (2) [Laravel tutorial most suitable for Chinese users] The following is a comment:
WithPages is used to query Pages tables.
This article was published last year and is old. you can refer to the new tutorial: 2016 Laravel series Getting Started Tutorial (1)
Laravel College is also a good tutorial website.
You can understand this method as syntactic sugar.