| 12345678910111213141516171819202122232425262728293031323334353637383940 |
- <?php
- namespace app\common\model;
- class ActivityModel extends BaseModel
- {
- protected $table = 'erp_activity';
- protected function genSchema(array $schema)
- {
- // TODO: Implement genSchema() method.
- }
- protected function relation() {
- return $this->hasMany(ActivityProductModel::class,'activity_id', 'id')->where('is_delete',0);
- }
- public function findByPaginate(array $params) {
- $where = [
- ['is_delete', '=', 0]
- ];
- return $this->where($where)
- ->with(['relation','relation.product'])
- ->order('update_time','desc')
- ->paginate(['list_rows'=>10, "query" => $params]);
- }
- public function findById($id) {
- return $this->where([
- ['id','=',$id],
- ['is_delete','=', 0]
- ])->with(['relation','relation.product'])->find();
- }
- }
|