Laravel 5: Views – view: sending data to view

Views: sending data to view

Laravel view is a HTML containing file populated with data passes from controller (usually).
Also read here.



Laravel view can be generally accessed from Controller, or Route closure using:

  • global view() function
  • View facade – View::make()

nested views

To access nested views – view files inside of sub-folders, dot.notation can be used, e.g.:

Above code specifies, that view file profile.blade.php is located in /admin sub-folder.

check if view exists

Passing Data
pass data using with()


or even

You can pass array using with():

pass data using array
array as argument

compact array

dynamic properties