<?php

namespace App\Models\Syj;

use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\Syj\GameLocationModel
 *
 * @property int $id
 * @property string $uuid
 * @property string $openid
 * @property string $lng 经度
 * @property string $lat 纬度
 * @property int $parent_id 父级ID
 * @property \Illuminate\Support\Carbon $created_at 创建时间
 * @property \Illuminate\Support\Carbon $updated_at 修改时间
 * @property-read \App\Models\Syj\UserModel $user
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\GameLocationModel newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\GameLocationModel newQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\GameLocationModel query()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\GameLocationModel whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\GameLocationModel whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\GameLocationModel whereLat($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\GameLocationModel whereLng($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\GameLocationModel whereOpenid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\GameLocationModel whereParentId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\GameLocationModel whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Syj\GameLocationModel whereUuid($value)
 * @mixin \Eloquent
 */
class GameLocationModel extends Model
{
    //

    protected $table = 'syj_game_locations';

    protected $dateFormat = 'U';

    protected $fillable = ['openid', 'uuid', 'lng', 'lat', 'parent_id'];


    public function user()
    {
        return $this->belongsTo(UserModel::class, 'openid', 'openid')->select('nickname', 'avatar', 'sex');
    }
}
