* @license GPL https://xxx.com * @link https://xxx.com * @ctime: 2020/5/19 9:36 */ namespace App\Repositories; use App\Models\PunishmentOrder; class PunishmentOrderRepository extends BaseRepository { public function __construct(PunishmentOrder $punishmentOrder) { $this->model = $punishmentOrder; } public function getAllByUserId($user_id){ return $this->model->query()->where('user_id',$user_id)->paginate(); } public function getModelByNo($no){ return $this->model->query()->where('no',$no)->first(); } public function isPay($no){ return $this->model->query()->where('no',$no)->where('pay_status',PunishmentOrder::PAY_STATUS_OK)->first(); } /** * checkNoPayModel * * @param $user_id * @return bool * @author Fx * */ public function checkNoPayModel($user_id){ $order = $this->model ->query() ->where('user_id',$user_id) ->where('pay_status',PunishmentOrder::PAY_STATUS_NO) ->first(); return empty($order); } }