Passing sizeable data to view (Best Practice)

Posted 9 months ago by ochirach


Version 5.4

What is the best practice method of passing data from the database (via controller) to the view in Laravel?

I have a 'user' view that displays all kinds of user information.

Names, Birthday, address, numbers, etc

Should I cram all this eloquent database logic to a single method (public index(){}) then store all in arrays relating to the data types (i.e names array, addresses array) as this information is to appear onload?


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

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.