love_php/app/Models/UnionUser.php
2026-04-02 09:20:51 +08:00

63 lines
1.4 KiB
PHP

<?php
namespace App\Models;
use App\Models\Live\Viewer;
use App\Models\Server\MerchantUser;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Tymon\JWTAuth\Contracts\JWTSubject;
use App\Models\Server\MerchantAccount;
class UnionUser extends Authenticatable implements JWTSubject
{
protected $hidden = ['password'];
protected $fillable = ['mobile', 'password'];
public function getMobileAttribute($value)
{
if (strstr($value, 'u')) return null;
return $value;
}
/**
* Get the identifier that will be stored in the subject claim of the JWT.
*
* @return mixed
*/
public function getJWTIdentifier()
{
return $this->getKey();
}
/**
* Return a key value array, containing any custom claims to be added to the JWT.
*
* @return array
*/
public function getJWTCustomClaims()
{
return [];
}
public function merchantUser()
{
return $this->hasOne(MerchantUser::class, 'uuid','id');
}
public function viewer()
{
return $this->hasOne(Viewer::class, 'uuid','id');
}
public function merchantAccount()
{
return $this->hasOne(MerchantAccount::class, 'uuid', 'id');
}
public function user()
{
return $this->hasOne(User::class, 'uuid', 'id');
}
}