Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
42 | public function slug(string $slug) : Builder |
||
43 | { |
||
44 | // Check whether queried table has 'slug' column |
||
45 | if ( ! Schema::hasColumn($this->model->getTable(), 'slug')) { |
||
46 | $message = "Column 'slug' not found in {$this->model->getTable()} table"; |
||
47 | |||
48 | throw new ColumnNotFoundException($message); |
||
49 | } |
||
50 | |||
51 | return $this->where('slug', $slug); |
||
52 | } |
||
53 | } |
||
54 |
If you implement
__call
and you know which methods are available, you can improve IDE auto-completion and static analysis by adding a @method annotation to the class.This is often the case, when
__call
is implemented by a parent class and only the child class knows which methods exist: