Msg.php 620 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. namespace App\Models;
  3. use Dcat\Admin\Traits\HasDateTimeFormatter;
  4. use Illuminate\Database\Eloquent\Model;
  5. class Msg extends Model
  6. {
  7. use HasDateTimeFormatter;
  8. protected $table = 'msg';
  9. protected $fillable = [
  10. 'type',
  11. 'user_id',
  12. 'to_user_id',
  13. 'title',
  14. 'content',
  15. ];
  16. public function type(){
  17. return [ 1 => '喜欢通知', 2 => '下载通知', 3 => '保存通知', 4 => '下架通知', 5 => '关注的人发了新作品', 6 => '系统通知'];
  18. }
  19. public function user(){
  20. return $this->hasOne(User::class,'id','to_user_id');
  21. }
  22. }