我需要将点 fron 一个用户转移到另一个用户



我需要将点从一个用户转移到另一个用户,谁能告诉我如何继续。我想将属于用户 A 的点数据复制到用户 B,首先,我将获取用户 A 的数据。

假设用户 A 有 6 分,而您想将其转移到用户 B 中只有 1 个可怜的点。

$userB =User::where('email', 'b@mail.com')->first(); //get userB 
$userA =User::where('email', 'a@mail.com')->first(); //get userA 
//dont worry if you have these objects already.
//Now to transfer point
$userB->point =$userA->point;  //the transfer has happened;
$userB->update();

相关内容

最新更新