<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Pt extends Model
{
    //指定表名
    protected $table ='pt';
    // 拒绝添加的字段
    protected $guarded = [];
    public $timestamps=false;

    //添加平台
    public function addpt_model($param){

        if (empty($param['pt_name'])){
            return ['Data'=>'','ErrorCode'=>3,'ErrorMessage'=>'平台名称不能为空'];

        }
        if(empty($param['sord'])){
            return ['Data'=>'','ErrorCode'=>4,'ErrorMessage'=>'首字母不能为空'];
        }
        $res = $this->insert($param);
        if ($res){
            return ['Data'=>'','ErrorCode'=>1,'ErrorMessage'=>'添加成功'];
        }else{
            return ['Data'=>'','ErrorCode'=>2,'ErrorMessage'=>'添加失败'];
        }
    }


    //删除平台
    public function delpt_model($id){
        return $id;exit;
        $res = $this->where('id',$id)->delete();
        if ($res){
            return [['Data'=>'','ErrorCode'=>1,'ErrorMessage'=>'删除成功']];
        }else{
            return [['Data'=>'','ErrorCode'=>2,'ErrorMessage'=>'删除失败']];
        }
    }


}
