You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
376 B

<?php
namespace app\model;
use think\Model;
class Product extends Model
{
protected $table = 'products';
protected $pk = 'id';
public function scopeStatus($query)
{
return $query->where('status', 1);
}
public function scopeByCategory($query, $cate)
{
return $query->where('category', $cate)->order('sort_order', 'asc');
}
}