Skip to content

Instantly share code, notes, and snippets.

@whisher
Created September 25, 2014 16:28
Show Gist options
  • Select an option

  • Save whisher/bef5e8a3401d0e0c8f10 to your computer and use it in GitHub Desktop.

Select an option

Save whisher/bef5e8a3401d0e0c8f10 to your computer and use it in GitHub Desktop.
in HomeController
$token = csrf_token();
$this->layout->content = View::make('home.content')->with('data', array('token'=> $token, 'user'=> json_encode($userData)));
in blade
@section('content')
<div class="content" data-ui-view></div>
<script type="text/javascript">
window.user = <% $data['user'] %>;
document.cookie = "XSRF-TOKEN=<% $data['token'] %>";
</script>
@stop
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment