Article.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. namespace App\Http\Models;
  3. use Eloquent;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Database\Eloquent\SoftDeletes;
  6. use Illuminate\Database\Query\Builder;
  7. use Illuminate\Support\Carbon;
  8. /**
  9. * 文章
  10. * Class Article
  11. *
  12. * @package App\Http\Models
  13. * @mixin Eloquent
  14. * @property int $id
  15. * @property string $title 标题
  16. * @property string|null $author 作者
  17. * @property string|null $summary 简介
  18. * @property string|null $logo LOGO
  19. * @property string|null $content 内容
  20. * @property int|null $type 类型:1-文章、2-公告、3-购买说明、4-使用教程
  21. * @property int $sort 排序
  22. * @property Carbon|null $created_at 创建时间
  23. * @property Carbon|null $updated_at 最后更新时间
  24. * @property Carbon|null $deleted_at 删除时间
  25. * @method static bool|null forceDelete()
  26. * @method static \Illuminate\Database\Eloquent\Builder|Article newModelQuery()
  27. * @method static \Illuminate\Database\Eloquent\Builder|Article newQuery()
  28. * @method static Builder|Article onlyTrashed()
  29. * @method static \Illuminate\Database\Eloquent\Builder|Article query()
  30. * @method static bool|null restore()
  31. * @method static \Illuminate\Database\Eloquent\Builder|Article type($type)
  32. * @method static \Illuminate\Database\Eloquent\Builder|Article whereAuthor($value)
  33. * @method static \Illuminate\Database\Eloquent\Builder|Article whereContent($value)
  34. * @method static \Illuminate\Database\Eloquent\Builder|Article whereCreatedAt($value)
  35. * @method static \Illuminate\Database\Eloquent\Builder|Article whereDeletedAt($value)
  36. * @method static \Illuminate\Database\Eloquent\Builder|Article whereId($value)
  37. * @method static \Illuminate\Database\Eloquent\Builder|Article whereLogo($value)
  38. * @method static \Illuminate\Database\Eloquent\Builder|Article whereSort($value)
  39. * @method static \Illuminate\Database\Eloquent\Builder|Article whereSummary($value)
  40. * @method static \Illuminate\Database\Eloquent\Builder|Article whereTitle($value)
  41. * @method static \Illuminate\Database\Eloquent\Builder|Article whereType($value)
  42. * @method static \Illuminate\Database\Eloquent\Builder|Article whereUpdatedAt($value)
  43. * @method static Builder|Article withTrashed()
  44. * @method static Builder|Article withoutTrashed()
  45. */
  46. class Article extends Model
  47. {
  48. use SoftDeletes;
  49. protected $table = 'article';
  50. protected $primaryKey = 'id';
  51. protected $dates = ['deleted_at'];
  52. // 筛选类型
  53. function scopeType($query, $type)
  54. {
  55. return $query->whereType($type);
  56. }
  57. }