generated from panliang/owl-admin-starter
34 lines
698 B
PHP
34 lines
698 B
PHP
<?php
|
|
|
|
namespace App\ModelFilters;
|
|
|
|
use EloquentFilter\ModelFilter;
|
|
use App\Models\Keyword;
|
|
|
|
class BannerFilter extends ModelFilter
|
|
{
|
|
/**
|
|
* 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 place($id)
|
|
{
|
|
$this->where('place_id', $id);
|
|
}
|
|
|
|
public function title($title)
|
|
{
|
|
$this->whereLike('title', $title);
|
|
}
|
|
|
|
public function key($key)
|
|
{
|
|
$ids = Keyword::whereIn('key', is_array($key) ? $key : explode(',', $key))->pluck('id');
|
|
$this->whereIn('place_id', $ids);
|
|
}
|
|
}
|