dimanche 4 octobre 2015

Attach user ID to save/update/create in a clean way in Laravel 5.1

So I have a lot of controllers that will be created by one user. So on every save/create/update I want the user's ID to be saved the resource's user_id column in the database.

I know that before the actual database update I could go like

$resource->user_id = Auth::user()->id;

but this seems pretty unclean and I don't wanna do this for all the create/update actions I have spread across multiple controllers.

What would be the best and cleanest way to approach this issue?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire