<?php

namespace App\Modules\OfficialAccount\Models;

use Illuminate\Database\Eloquent\Model;

class OfficialCustomMsg extends Model
{
	protected $connection = 'api_mysql';
	
    protected $table = 'official_custom_msg';

    protected $fillable = ['title','description','url','image','text','channelname'];

    /**
     * 根据text获取客服消息
     */
    static function officialCustomMsgByText($text)
    {
        
       	return self::where('text',$text)->first();
    
    }

    /**
     * 根据channelname和text获取神书
     */
    static function customerMsgByChannelAndText($channelname,$text)
    {
    	return self::where(['channelname'=>$channelname,'text'=>$text])->get();
    }

}


