mardi 27 septembre 2016

Saving a group's relationship?

I'm using Laravel 5.3.

If I do something like this:

$posts = Post::where('id', 1)
    ->with('stats')
    ->first();

Is it possible to save the stats relationship, like:

$posts->stats->num_users = 5;
$posts->stats->save();

Is this right to do or is there a different way?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2ddxbNq
via IFTTT

Aucun commentaire:

Enregistrer un commentaire