<?php

namespace App\Modules\Cpa\Models;

use Illuminate\Database\Eloquent\Model;

class Advertise extends Model
{
    protected $table = 'advertise_products';
    protected $fillable = ['id', 'name', 'name_desc', 'img', 'source_url', 'status'];

    static function getAds($limit=''){
        $obj = self::where('status',1);
        if($limit){
            $obj->limit($limit);
        }
        return $obj->get();
    }

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