<?php

namespace App\Models;

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

/**
 * App\Models\ShowroomCase
 *
 * @property int $id
 * @property int $showroom_id 展厅ID
 * @property string $name 名称
 * @property string|null $videos 案例视频
 * @property string|null $images 案例图片
 * @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|ShowroomCase newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|ShowroomCase newQuery()
 * @method static \Illuminate\Database\Query\Builder|ShowroomCase onlyTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|ShowroomCase query()
 * @method static \Illuminate\Database\Eloquent\Builder|ShowroomCase whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ShowroomCase whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ShowroomCase whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ShowroomCase whereImages($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ShowroomCase whereIsOpened($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ShowroomCase whereName($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ShowroomCase whereShowroomId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ShowroomCase whereSort($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ShowroomCase whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|ShowroomCase whereVideos($value)
 * @method static \Illuminate\Database\Query\Builder|ShowroomCase withTrashed()
 * @method static \Illuminate\Database\Query\Builder|ShowroomCase withoutTrashed()
 * @mixin \Eloquent
 * @property-read \App\Models\Showroom|null $showroom
 */
class ShowroomCase extends Model
{
	use HasDateTimeFormatter;
    use SoftDeletes;

    protected $table = 'showroom_cases';

    protected $casts = [
        'videos' => 'json',
        'images' => 'json',
    ];

    public function showroom(): \Illuminate\Database\Eloquent\Relations\BelongsTo
    {
        return $this->belongsTo(Showroom::class,'showroom_id','id');
    }

}
