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?!