<?php namespace App\Models; use Illuminate\Database\Eloquent\Model; class ProblemRecommend extends Model { protected $table = 'problem_recommend'; protected $primaryKey = 'id'; const CREATED_AT = 'creation_date'; public static function getList(int $page,int $limit) { $offset = ($page - 1) * $limit; $query = self::query()->where(['status'=>0])->orderBy('created_at','desc')->offset($offset)->limit($limit)->get(); if ($query){ return $query->toArray(); }else{ return []; } } public static function insertData(array $data) { return self::query()->insert($data); } public static function del(int $id) { return self::query()->where('id', $id)->delete(); } }