Skip to content

Instantly share code, notes, and snippets.

@natp0ng
Created April 16, 2014 19:04
Show Gist options
  • Save natp0ng/10921332 to your computer and use it in GitHub Desktop.
Save natp0ng/10921332 to your computer and use it in GitHub Desktop.
pass data from controller to blade template laravel
<?php
$data =
[
'page_title' => 'Login',
'second_item' => 'value'
...
];
return View::make('authentication/login', $data);
// or
return View::make('authentication/login', compact('data'));
// or
return View::make('authentication/login')->with($data);
// or
return View::make('authentication/login')->with(['page_title' => 'Login', 'second_item' => 'value']);
// or
return View::make('authentication/login')->with(array('page_title' => 'Login', 'second_item' => 'value'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment