123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- <?php
- namespace app\admin\model;
- use app\common\models\Archives as ArchivesModel;
- use app\common\models\Category;
- class Archives extends ArchivesModel {
-
- public function searchPidAttr($query, $value, $data){
- if(!empty($value) && $value != '-1'){
- $query->where('archives.pid','=',$value);
- }
- }
-
- public function searchTitleAttr($query, $value, $data){
- if(!empty($value)){
- $query->where("archives.title","like","%".$value."%");
- }
- }
-
- public function category(){
- return $this->hasOne(Category::class,'id','pid')->joinType("LEFT")->bind(["cat_name"=>"title"]);
- }
- }
|