Support the ongoing development of Laravel.io →
Database Eloquent Views
Last updated 2 years ago.
0

You should pass $data to closure by reference:

DB::transaction(function() use ($user, &$data)
0

Why do you need to use Transaction? I think a better implementation for this is:

View::composer(array('profile','dashboard'), function($view)
{
    $view->with('count', User::count());
});

L5: http://laravel.com/docs/5.0/views#view-composers L4: http://laravel.com/docs/4.2/responses#view-composers

0

@beanmoss This is just an example. I run like 10 queries and thought it would be nice to commit them in one single transaction?!

0

i encountered the same problem too. @MichealMi, did you found a solution?

0

Sign in to participate in this thread!

Eventy

Your banner here too?

LukasMa lukasma Joined 26 Nov 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.