1. Home
  2. Laravel
  3. 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