1234567891011121314151617181920212223242526272829 |
- <?php
- namespace App\Modules\CpSub\Models;
- use Illuminate\Database\Eloquent\Model;
- class CpBookCalculate extends Model
- {
- protected $table = 'cp_book_calculates';
- protected $fillable = ['cp_source','bid','start_date','status','available_amount_ratio','last_amount_ratio','total_amount_ratio','created_at','updated_at'];
-
- public static function getCpBookCalculate($cp_source,$bid) {
- return self::where(['cp_source'=>$cp_source,'bid'=>$bid,'status'=>1])
- ->where('start_date','<=',date('Y-m-d',strtotime('-1 day')))
- ->where('end_date','>=',date('Y-m-d',strtotime('-1 day')))
- ->first();
- }
- public static function getAllCpBookCalculateBids()
- {
- return self::where(['status'=>1])
- ->where('start_date','<=',date('Y-m-d',strtotime('-1 day')))
- ->where('end_date','>=',date('Y-m-d',strtotime('-1 day')))
- ->get()
- ->pluck('bid')
- ->all();
- }
- }
|