Task.php 713 字节
<?php

namespace App\Models\Task;

use App\Models\Base;
use App\Services\Facades\Upload;

class Task extends Base
{
    //设置关联表名
    protected $table = 'gl_task';

    const STATUS_WAIT = 0;
    const STATUS_DONGING = 1;
    const STATUS_DOWN = 2;


    public static function statusMap(){
        return [
            self::STATUS_WAIT    => '未开始',
            self::STATUS_DONGING   => '进行中',
            self::STATUS_DOWN  => '已完成',
        ];
    }

    public function setAttachmentAttribute($value){
        $this->attributes['attachment'] = Upload::url2path($value);
    }

    public function getAttachmentAttribute($value){
        return Upload::path2url($value);
    }

}