| Conditions | 2 |
| Paths | 2 |
| Total Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 17 | public static function model($class, $text, $id = 'id', $foreign = null) |
||
| 18 | { |
||
| 19 | if ($class instanceof Builder) { |
||
| 20 | $table = $class->getModel()->getTable(); |
||
|
|
|||
| 21 | } else { |
||
| 22 | $table = app($class)->getTable(); |
||
| 23 | } |
||
| 24 | |||
| 25 | $table = Str::singular($table); |
||
| 26 | $foreign = $foreign ?? $table . '_id'; |
||
| 27 | |||
| 28 | return self::make($foreign, Str::title($table)) |
||
| 29 | ->modelOptions($class, $text, $id); |
||
| 30 | } |
||
| 31 | |||
| 56 |
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: