<?php

namespace App\Models;

use App\Models\BaseModel;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * @description 评论管理
 * @author  system;
 * @version    1.0
 * @date 2018-07-03 16:52:38
 *
 */
class AlbumReviewModel extends BaseModel
{
    use SoftDeletes;
    /**
     * 数据表名
     *
     * @var string
     *
     */
    protected $table = 'album_review';
    /**
     * 主键
     */
    protected $primaryKey = 'id';

    //分页
    protected $perPage = PAGE_NUMS;

    /**
     * 可以被集体附值的表的字段
     *
     * @var string
     */
    protected $fillable = [
        'verifier_review',
        'producer_review',
        'packer_review',
        'description',
        'picture',
        'order_id',
        'store_id'
    ];

    public function order()
    {
        return $this->belongsTo('App\Models\AlbumOrderModel','order_id');
    }

    public function verifier_review(){
        switch ($this->verifier_review){
            case 1:
                return '中评';
                break;
            case 2:
                return '差评';
                break;
            default:
                return '好评';
        }
    }

    public function producer_review(){
        switch ($this->producer_review){
            case 1:
                return '中评';
                break;
            case 2:
                return '差评';
                break;
            default:
                return '好评';
        }
    }

    public function packer_review(){
        switch ($this->packer_review){
            case 1:
                return '中评';
                break;
            case 2:
                return '差评';
                break;
            default:
                return '好评';
        }
    }

}