1 | <?php |
||
23 | class Version extends Model |
||
24 | { |
||
25 | /** |
||
26 | * @var array |
||
27 | */ |
||
28 | protected $casts = [ |
||
29 | 'contents' => 'array', |
||
30 | ]; |
||
31 | |||
32 | /** |
||
33 | * @return \Illuminate\Database\Eloquent\Relations\BelongsTo |
||
34 | */ |
||
35 | public function user() |
||
39 | |||
40 | /** |
||
41 | * @return \Illuminate\Database\Eloquent\Relations\MorphTo |
||
42 | */ |
||
43 | 2 | public function versionable() |
|
47 | |||
48 | /** |
||
49 | * @param \Illuminate\Database\Eloquent\Model $model |
||
50 | * |
||
51 | * @return \Overtrue\LaravelVersionable\Version |
||
52 | */ |
||
53 | 5 | public static function createForModel(Model $model) |
|
68 | |||
69 | /** |
||
70 | * @return bool |
||
71 | */ |
||
72 | 1 | public function revert() |
|
76 | |||
77 | /** |
||
78 | * @param \Illuminate\Database\Eloquent\Model|null $model |
||
79 | * |
||
80 | * @return string |
||
81 | */ |
||
82 | 1 | public function diff(Model $model = null) |
|
98 | } |
||
99 |
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: