1 | <?php |
||
28 | abstract class User extends Model implements AuthenticatableContract, CanResetPasswordContract, AuthorizableContract |
||
29 | { |
||
30 | use Authenticatable, CanResetPassword, Authorizable, Notifiable, UserPresenter; |
||
31 | |||
32 | protected $guarded = ['id']; |
||
33 | protected $hidden = ['password', 'remember_token']; |
||
34 | protected $dates = ['last_activity']; |
||
35 | |||
36 | abstract public function guardDriver(): string; |
||
37 | |||
38 | abstract public function getHomeUrl(): string; |
||
39 | |||
40 | abstract public function getProfileUrl(): string; |
||
41 | |||
42 | public function getNameAttribute(): string |
||
46 | |||
47 | public function hasNeverLoggedIn(): bool |
||
51 | |||
52 | public function registerLastActivity(): User |
||
58 | |||
59 | public function isCurrentUser(): bool |
||
71 | |||
72 | /** |
||
73 | * @param string $token |
||
74 | * |
||
75 | * @return \App\Services\Auth\User|null |
||
76 | */ |
||
77 | public static function findByToken(string $token) |
||
87 | |||
88 | /** |
||
89 | * @param string $email |
||
90 | * |
||
91 | * @return \App\Services\Auth\User|null |
||
92 | */ |
||
93 | public static function findByEmail(string $email) |
||
97 | } |
||
98 |
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: