yijia-webman/app/model/Goods.php

27 lines
626 B
PHP

<?php
namespace app\model;
class Goods extends Base
{
protected $createTime = false;
protected $updateTime = false;
public static function getPageList($name = '', $size = 20, $order = 'id desc')
{
return self::when(!empty($name), function($query) use($name){
$query->where('name', 'like', "%$name%");
})
->order($order)
->paginate([
'list_rows'=> $size,
'var_page' => 'page',
]);
}
public static function getByName($name)
{
$name = trim($name);
return self::where('name', $name)->findOrEmpty();
}
}