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

40 lines
732 B
PHP

<?php
namespace App\ModelFilters;
use EloquentFilter\ModelFilter;
class CropFilter extends ModelFilter
{
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);
}
public function category($categoryId)
{
return $this->where('category_id', $categoryId);
}
public function parent($parentId)
{
return $this->where('parent_id', $parentId);
}
}