| 1 | <?php |
||
| 11 | trait HasSelector |
||
| 12 | { |
||
| 13 | /** |
||
| 14 | * @var Selector |
||
| 15 | */ |
||
| 16 | protected $selector; |
||
| 17 | |||
| 18 | /** |
||
| 19 | * @param \Closure $closure |
||
| 20 | * |
||
| 21 | * @return $this |
||
| 22 | */ |
||
| 23 | public function selector(\Closure $closure) |
||
| 35 | |||
| 36 | /** |
||
| 37 | * Apply selector query to grid model query. |
||
| 38 | * |
||
| 39 | * @return $this |
||
| 40 | */ |
||
| 41 | protected function applySelectorQuery() |
||
| 69 | |||
| 70 | /** |
||
| 71 | * Render grid selector. |
||
| 72 | * |
||
| 73 | * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View|string |
||
| 74 | */ |
||
| 75 | public function renderSelector() |
||
| 79 | } |
This check looks for methods that are used by a trait but not required by it.
To illustrate, let’s look at the following code example
The trait
Idableprovides a methodequalsIdthat in turn relies on the methodgetId(). If this method does not exist on a class mixing in this trait, the method will fail.Adding the
getId()as an abstract method to the trait will make sure it is available.