DiaryModel.php 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. <?php
  2. namespace App\Models\Diary;
  3. use App\Models\User\UserModel;
  4. use Illuminate\Database\Eloquent\Model;
  5. use Illuminate\Database\Eloquent\SoftDeletes;
  6. /**
  7. * App\Models\Diary\DiaryModel
  8. *
  9. * @property int $id
  10. * @property int $uid uid
  11. * @property string $content 内容
  12. * @property string $images 图片
  13. * @property int $thumb 点赞数量
  14. * @property int $private 是否私有
  15. * @property int $selected_at 精选时间
  16. * @property int $topped_at 指定时间
  17. * @property \Illuminate\Support\Carbon $created_at 创建时间
  18. * @property \Illuminate\Support\Carbon $updated_at 修改时间
  19. * @property int|null $deleted_at 删除时间
  20. * @property int|null $violationed_at 违规时间(管理员删除的时间)
  21. * @property-read \App\Models\User\UserModel $user
  22. * @method static bool|null forceDelete()
  23. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Diary\DiaryModel newModelQuery()
  24. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Diary\DiaryModel newQuery()
  25. * @method static \Illuminate\Database\Query\Builder|\App\Models\Diary\DiaryModel onlyTrashed()
  26. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Diary\DiaryModel query()
  27. * @method static bool|null restore()
  28. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Diary\DiaryModel whereContent($value)
  29. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Diary\DiaryModel whereCreatedAt($value)
  30. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Diary\DiaryModel whereDeletedAt($value)
  31. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Diary\DiaryModel whereId($value)
  32. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Diary\DiaryModel whereImages($value)
  33. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Diary\DiaryModel wherePrivate($value)
  34. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Diary\DiaryModel whereSelectedAt($value)
  35. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Diary\DiaryModel whereThumb($value)
  36. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Diary\DiaryModel whereToppedAt($value)
  37. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Diary\DiaryModel whereUid($value)
  38. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Diary\DiaryModel whereUpdatedAt($value)
  39. * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Diary\DiaryModel whereViolationedAt($value)
  40. * @method static \Illuminate\Database\Query\Builder|\App\Models\Diary\DiaryModel withTrashed()
  41. * @method static \Illuminate\Database\Query\Builder|\App\Models\Diary\DiaryModel withoutTrashed()
  42. * @mixin \Eloquent
  43. */
  44. class DiaryModel extends Model
  45. {
  46. use SoftDeletes;
  47. protected $table = "kdgx_fpdx_diarys";
  48. protected $dateFormat = 'U';
  49. public $fillable = ['uid', 'content', 'images', 'private', 'thumb', 'violationed_at', 'selected_at', 'topped_at'];
  50. public function user()
  51. {
  52. return $this->belongsTo(UserModel::class, 'uid', 'uid')->select("nickname", "headimgurl");
  53. }
  54. }