34 lines
634 B
PHP
34 lines
634 B
PHP
<?php
|
|
|
|
namespace App\Filters;
|
|
|
|
use EloquentFilter\ModelFilter;
|
|
|
|
class ArticleFilter extends ModelFilter
|
|
{
|
|
protected $drop_id = false;
|
|
|
|
/**
|
|
* Related Models that have ModelFilters as well as the method on the ModelFilter
|
|
* As [relationMethod => [input_key1, input_key2]].
|
|
*
|
|
* @var array
|
|
*/
|
|
public $relations = [];
|
|
|
|
public function title($v)
|
|
{
|
|
$this->whereLike('title', $v);
|
|
}
|
|
|
|
public function categoryId($v)
|
|
{
|
|
$this->where('category_id', $v);
|
|
}
|
|
|
|
public function categoryPath($v)
|
|
{
|
|
$this->where('category_path', 'like', '%-'.$v.'-%');
|
|
}
|
|
}
|