how to call eloquent model function in collection of laravel code example Example: laravel collection namespace Illuminate\Database\Eloquent\Collection