<?php

namespace App\Models;

use Illuminate\Database\Eloquent\SoftDeletes;
use Slowlyo\OwlAdmin\Models\BaseModel as Model;
use \Laravel\Sanctum\HasApiTokens;

/**
 * 用户
 */
class MemberUser extends Model
{
	use HasApiTokens, SoftDeletes;

	protected $table = 'member_users';
	protected $hidden = ['password'];
	protected $fillable = ['mobile', 'state', 'register_area'];

	protected static function booted()
	{
		static::created(function ($user) {
			$user->wallet()->create([
				'owner_type' => MemberUser::class,
				'owner_id' => $user->id
			]);
		});
	}
}
