<?php

namespace App\Models\Goodnight;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * App\Models\Goodnight\VoiceModel
 *
 * @property int $id
 * @property \Illuminate\Support\Carbon $created_at 创建时间
 * @property \Illuminate\Support\Carbon $updated_at 更新时间
 * @property int|null $deleted_at 删除时间
 * @property int $uid 用户
 * @property int $sex 性别0未知1男2女
 * @property string $cover 封面地址
 * @property string $voice 声音地址
 * @property string $tags 标签
 * @property int $check 审核:0待审核;1通过;-1不通过
 * @property int $like 喜欢的数量
 * @property int $view 推送次数
 * @property int $commit 推荐
 * @property int $expedit
 * @property int $topic_id topic
 * @property int $topic_example_id examples
 * @property-read \App\Models\User\UserModel $user
 * @method static bool|null forceDelete()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel newQuery()
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Goodnight\VoiceModel onlyTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel query()
 * @method static bool|null restore()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel whereCheck($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel whereCommit($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel whereCover($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel whereDeletedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel whereExpedit($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel whereLike($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel whereSex($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel whereTags($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel whereTopicExampleId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel whereTopicId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel whereUid($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel whereView($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Goodnight\VoiceModel whereVoice($value)
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Goodnight\VoiceModel withTrashed()
 * @method static \Illuminate\Database\Query\Builder|\App\Models\Goodnight\VoiceModel withoutTrashed()
 * @mixin \Eloquent
 */
class VoiceModel extends Model
{
    use SoftDeletes;

    protected $table = "kdgx_goodnight_voice";

    protected $dateFormat = 'U';

    protected $fillable = [
        'uid',
        'sex',
        'deleted_at',
        'cover',
        'voice',
        'tags',
        'check',
        'like',
        'view',
        'commit',
        'expedit',
        'topic_id',
        'topic_example_id'
    ];


    public function user()
    {
        return $this->belongsTo(\App\Models\User\UserModel::class, 'uid', 'uid')->select(
            'nickname',
            'headimgurl',
            'sex'
        );
    }
}
