| Conditions | 2 |
| Paths | 1 |
| Total Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | protected static function bootUsedByTeams() |
||
| 19 | { |
||
| 20 | static::addGlobalScope('team', function (Builder $builder) { |
||
| 21 | static::teamGuard(); |
||
| 22 | |||
| 23 | $builder->where($builder->getQuery()->from.'.team_id', auth()->user()->currentTeam->getKey()); |
||
|
|
|||
| 24 | }); |
||
| 25 | |||
| 26 | static::saving(function (Model $model) { |
||
| 27 | if (! isset($model->team_id)) { |
||
| 28 | static::teamGuard(); |
||
| 29 | |||
| 30 | $model->team_id = auth()->user()->currentTeam->getKey(); |
||
| 31 | } |
||
| 32 | }); |
||
| 33 | } |
||
| 34 | |||
| 62 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: