<?php

namespace App;

use Illuminate\Database\Eloquent\Model;
use Mtc\Modules\Members\Models\Member;


class MemberInfo extends Model
{

    protected $table = 'members_info';


    public static function registerSiteOfOrigin(Member $member, int $site_id)
    {
        $member_info = MemberInfo::query()
            ->where('member_id', $member->id)
            ->first()
        ;

        if (! $member_info) {
            $member_info = new MemberInfo();
            $member_info->member_id = $member->id;
            $member_info->save();
        }

        return $member_info->id;
    }


    public static function getSiteOfOrigin(Member $member) : string
    {
        return config('app.name');
    }

}
