1. Home
  2. ›
  3. Laravel
  4. ›
  5. Compact

Compact function allows you to pass data to the view.

#laravel#view
$color = 'blue';
$shape = 'square';

view('geometry',compact("color","shape")); 
copy
Full Laravel cheatsheet