<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class User_grade extends Model
{
    public $timestamps = false;
    protected $table='dc_user_grade';

    protected function grade() {
    	$data = $this->orderBy('id','desc')->get();
    	if(!$data){
            return -50014322;
        }
        $data=$data->toArray();
    	return $data;
    }
    //获取等级 名称的数组对
    protected function getGradeNameArray(){
        $data=$this->select('grade','name')->orderBy('id','desc')->get();
        if(!$data){
            return -50014322;
        }
        $data=$data->toArray();
        $resArr=array();
        foreach ($data as $k=>$v){
            $resArr[$v['grade']]=$v['name'];
        }
        return $resArr;
    }
}
