<?php

namespace App\Modules\OfficialAccount\Models;

use Illuminate\Database\Eloquent\Model;

class OfficialImgtextUrls extends Model
{
    protected $tables = 'official_imgtext_urls';

    protected $fillable = ['content_source_url','book_name','chapter_sequence','img_url','title','content','author','digest','gzh_app_id','thumb_media_id','distribution_channel_id','send_orders_id','send_orders_name','send_orders_url','del_flag'];


    static function officialImgtextUrlsByChannelId($distribution_channel_id)
    {
        
        return self::where('distribution_channel_id', isset($distribution_channel_id) ? $distribution_channel_id : '')->where('del_flag',0)->orderBy('id','desc')->paginate();
    
    }

    static function getOfficialImgTxtUrlByBookName($distribution_channel_id,$book_name)
    {

        return self::where(['distribution_channel_id'=>isset($distribution_channel_id) ? $distribution_channel_id : '','book_name'=>isset($book_name) ? $book_name : ''])->where('del_flag',0)->orderBy('id','desc')->paginate();

    }


    static function officialImgtextUrlsById($id)
    {
        
        return self::where('id', isset($id) ? $id : '')->first();
    
    }



}


