// +---------------------------------------------------------------------- namespace App\Models; /** * 余额记录-模型 * @author laravel开发员 * @since 2020/11/11 * @package App\Models */ class BalanceLogModel extends BaseModel { // 设置数据表 protected $table = 'balance_logs'; /** * 用户 */ public function member() { return $this->hasOne(MemberModel::class, 'id','user_id') ->where(['mark'=>1]) ->select(['id', 'nickname','openid', 'balance','withdraw_total', 'mobile','status']); } /** * 司机 */ public function driver() { return $this->hasOne(DriverModel::class, 'id','user_id') ->where(['mark'=>1]) ->select(['id', 'realname', 'balance','withdraw_total', 'mobile','status']); } }