partner = PartnerBeautyUser::find($id); } protected $partner; /** * Execute the job. * * @return void */ public function handle() { $beauty_partner = $this->partner; if ( $beauty_partner && $beauty_partner->original_photo && $beauty_partner->new_photo && $beauty_partner->replaced_at > 0 && $beauty_partner->callback_at == 0 ) { DB::transaction(function () use ($beauty_partner) { $partner = PartnerModel::find($beauty_partner->partner_id); if ($partner->{$beauty_partner->field} == $beauty_partner->new_photo) { $partner->{$beauty_partner->field} = $beauty_partner->original_photo; $partner->save(); $user = UserModel::find($beauty_partner->uid); $user->{$beauty_partner->field} = $beauty_partner->original_photo; $user->save(); $beauty_partner->callback_at = time(); $beauty_partner->save(); } }); } } }