<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\Showroom
 *
 * @property int $id
 * @property string $name 名称
 * @property int $sort 排序越大越靠前
 * @property int $is_opened 是否启用 0-否 1-是
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property \Illuminate\Support\Carbon|null $deleted_at
 * @property \Illuminate\Support\Carbon|null $created_at
 * @method static \Illuminate\Database\Eloquent\Builder|Showroom newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|Showroom newQuery()
 * @method static \Illuminate\Database\Query\Builder|Showroom onlyTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|Showroom query()
 * @method static \Illuminate\Database\Eloquent\Builder|Showroom whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Showroom whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Showroom whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Showroom whereIsOpened($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Showroom whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Showroom whereSort($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Showroom whereUpdatedAt($value)
 * @method static \Illuminate\Database\Query\Builder|Showroom withTrashed()
 * @method static \Illuminate\Database\Query\Builder|Showroom withoutTrashed()
 * @mixin \Eloquent
 * @property string|null $cover_img 封面
 * @property string|null $detail 详情
 * @method static \Illuminate\Database\Eloquent\Builder|Showroom whereCoverImg($value)
 * @method static \Illuminate\Database\Eloquent\Builder|Showroom whereDetail($value)
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\StatShowroom[] $viewer
 * @property-read int|null $viewer_count
 */
class Showroom extends Model
{
	use HasDateTimeFormatter;
    use SoftDeletes;

    public function viewer(): HasMany
    {
        return $this->hasMany(StatShowroom::class,'showroom_id','id');
    }
}
