<?php

namespace App\Models;

use Dcat\Admin\Traits\HasDateTimeFormatter;

use Illuminate\Database\Eloquent\Model;

class Msg extends Model
{
	use HasDateTimeFormatter;
    protected $table = 'msg';

    protected $fillable = [
        'type',
        'user_id',
        'to_user_id',
        'title',
        'content',
    ];

    public function type(){
        return [ 1 => '喜欢通知', 2 => '下载通知', 3 => '保存通知', 4 => '下架通知', 5 => '关注的人发了新作品', 6 => '系统通知'];
    }

    public function user(){
        return $this->hasOne(User::class,'id','to_user_id');
    }
}
