QuestionTagModel.php 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. namespace App\Models\Invite;
  3. use Illuminate\Database\Eloquent\Model;
  4. /**
  5. * App\Models\Invite\QuestionTagModel
  6. *
  7. * @property int $id
  8. * @property string|null $type 类型
  9. * @property string $tag
  10. * @property int $use
  11. * @property \Illuminate\Support\Carbon $created_at
  12. * @property \Illuminate\Support\Carbon $updated_at
  13. * @property int $hide
  14. * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\Invite\QuestionTemplateModel[] $questions
  15. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTagModel display($bool)
  16. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTagModel newModelQuery()
  17. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTagModel newQuery()
  18. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTagModel query()
  19. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTagModel whereCreatedAt($value)
  20. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTagModel whereHide($value)
  21. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTagModel whereId($value)
  22. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTagModel whereTag($value)
  23. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTagModel whereType($value)
  24. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTagModel whereUpdatedAt($value)
  25. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTagModel whereUse($value)
  26. * @mixin \Eloquent
  27. */
  28. class QuestionTagModel extends Model
  29. {
  30. //
  31. protected $table = 'kdgx_fpdx_invitation_question_template_tags';
  32. public $dateFormat = 'U';
  33. protected $fillable = ['tag', 'use', 'type', 'hide'];
  34. public function questions()
  35. {
  36. return $this->hasMany(QuestionTemplateModel::class, 'tag_id', 'id');
  37. }
  38. /**
  39. * 显示的
  40. * @param \Illuminate\Database\Eloquent\Builder|\App\Models\Invite\QuestionTagModel $query
  41. * @return mixed
  42. */
  43. public function scopeDisplay($query, bool $bool)
  44. {
  45. $hide = $bool ? 0 : 1;
  46. return $query->where('hide', $hide);
  47. }
  48. }