'Weird Call to undefined method which is defined at the User Model
I have added this method to my User Model:
public function userType($type)
{
switch($type){
case 7;
return "Brand owner";
break;
case 9;
return "Shop owner";
break;
default:
return "undefined";
}
}
And then on my index.blade.php where I retrieve all the current users, I added this:
@foreach($users as $user)
<td>{{ $user->userType($user->member_type) }}</td>
@endforeach
But I get this error:
Call to undefined method App\Models\User::userType()
So what on earth is going wrong here?!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
