lcly-data-admin/app/ModelFilters/CropFilter.php

38 lines
726 B
PHP

<?php
namespace App\ModelFilters;
use EloquentFilter\ModelFilter;
class CropFilter extends ModelFilter
{
public function categoryId($categoryId)
{
return $this->where('category_id', $categoryId);
}
public function parentId($parentId){
return $this->where('parent_id', $parentId);
}
public function type($type)
{
$q = $this;
switch ($type) {
case 'top':
$q->where('parent_id', 0);
break;
case 'all':
break;
default:
break;
}
return $q;
}
public function cropType($cropType){
return $this->where('crop_type', $cropType);
}
}