<?php

namespace App\Models;
use DB;
use Illuminate\Database\Eloquent\Model;

class Routes extends BaseModel
{
	protected $table='system_routes';
	function getCode($list){
        $data = DB::table('system_routes AS gt')
            ->select("gt.id","gt.name","gt.rdesc","gt.remark","gt.ip","gt.url","gt.cate_id","gt.sort","gc.name AS cate_name")
            ->leftjoin('system_routes_category AS gc','gt.cate_id','=','gc.id')
            ->paginate($list);
	    // $data=$this->orderby('sort','desc')->get();
        if(!$data){
            return -6010000122;
        }
        return $data->toArray();
    }

    function getRole($id){
        $data=$this->where('id',$id)->first();
        if(!$data){
            return -7050001204;
        }
        return $data->toArray();
    }

}