SubscriptionFilter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A filter() 0 5 1
A mailing_list() 0 3 1
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