bugfix in Container.php: also return empty containers again
This commit is contained in:
parent
1ee019a37f
commit
dbc4a84d3f
1 changed files with 6 additions and 6 deletions
|
@ -29,14 +29,14 @@ class Container extends Model
|
|||
protected $hidden = ['created_at', 'deleted_at', 'updated_at'];
|
||||
|
||||
static function all($columns=Array()){
|
||||
return Container::join('items','items.cid','=','containers.cid')
|
||||
->select('items.cid', 'name', DB::raw('count(*) as itemCount'))
|
||||
->groupBy('items.cid', 'name')->get();
|
||||
return Container::leftJoin('items','items.cid','=','containers.cid')
|
||||
->select('containers.cid', 'name', DB::raw('count(items.iid) as itemCount'))
|
||||
->groupBy('containers.cid', 'name')->get();
|
||||
}
|
||||
|
||||
static function find($id){
|
||||
return Container::join('items','items.cid','=','containers.cid')
|
||||
->select('items.cid', 'name', DB::raw('count(*) as itemCount'))
|
||||
->groupBy('items.cid', 'name')->where('items.cid', '=', $id)->first();
|
||||
return Container::leftJoin('items','items.cid','=','containers.cid')
|
||||
->select('containers.cid', 'name', DB::raw('count(items.iid) as itemCount'))
|
||||
->groupBy('containers.cid', 'name')->where('items.cid', '=', $id)->first();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue