1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- <?php
- namespace App\Models\Invite;
- use Illuminate\Database\Eloquent\Model;
- /**
- * App\Models\Invite\QuestionTemplateModel
- *
- * @property int $id
- * @property int $created_at
- * @property int $updated_at
- * @property string $type 类型
- * @property string $title 问题
- * @property string $question 问题
- * @property string $author 作者
- * @property int $tag_id 标签ID
- * @property int $choice_count 选择次数
- * @property int $select_count 精选次数
- * @property int $hide 隐藏
- * @property-read \App\Models\Invite\QuestionTagModel $tag
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTemplateModel display($bool)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTemplateModel newModelQuery()
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTemplateModel newQuery()
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTemplateModel query()
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTemplateModel whereAuthor($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTemplateModel whereChoiceCount($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTemplateModel whereCreatedAt($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTemplateModel whereHide($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTemplateModel whereId($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTemplateModel whereQuestion($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTemplateModel whereSelectCount($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTemplateModel whereTagId($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTemplateModel whereTitle($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTemplateModel whereType($value)
- * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTemplateModel whereUpdatedAt($value)
- * @mixin \Eloquent
- */
- class QuestionTemplateModel extends Model
- {
- //
- protected $table = 'kdgx_fpdx_invitation_question_templates';
- protected $fillable = ['type', 'question', 'author', 'tag_id', 'choice_count', 'select_count', 'hide'];
- public $timestamps = false;
- public function tag()
- {
- return $this->belongsTo(QuestionTagModel::class, 'tag_id', 'id')->select('id', 'tag');
- }
- /**
- * 显示的
- * @param $query
- * @return mixed
- */
- public function scopeDisplay($query, bool $bool)
- {
- $hide = $bool ? 0 : 1;
- return $query->where('hide', $hide);
- }
- }
|