first() and update() row in one query

Posted 6 months ago by timgavin

How can I do this in one line?

$account = Account::where('user_id', $user->id)->first();
$account->update(['balance' => $account->balance + 25]);

Please sign in or create an account to participate in this conversation.