SubscriptionFilter::filter()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 1
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Filters;
4
5
use EloquentFilter\ModelFilter;
6
7
class SubscriptionFilter extends ModelFilter
8
{
9
    /**
10
     * Related Models that have ModelFilters as well as the method on the ModelFilter
11
     * As [relatedModel => [input_key1, input_key2]].
12
     *
13
     * @var array
14
     */
15
    public $relations = [];
16
17
    /**
18
     * @param $filter
19
     * @return $this
20
     */
21
    public function filter($filter)
22
    {
23
        return $this->where(function ($q) use ($filter) {
0 ignored issues
show
Bug introduced by
The method where() does not exist on App\Filters\SubscriptionFilter. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
        return $this->/** @scrutinizer ignore-call */ where(function ($q) use ($filter) {
Loading history...
24
            return $q->where('email', 'LIKE', '%'.$filter.'%')
25
                ->orWhere('name', 'LIKE', '%'.$filter.'%');
26
        });
27
    }
28
29
    /**
30
     * @param $id
31
     * @return $this
32
     */
33
    public function mailing_list($id)
34
    {
35
        return $this->where('mailing_list_id', $id);
36
    }
37
}
38