I have an Eloquent Model called Surface, which depends on the ZipCodeRepository object:
class Surface extends Model{ public function __construct(ZipCodeRepositoryInterface $zipCode){...}
and an Address object that has many surfaces.
class Address extends Model{ public surfaces() { return $this->hasMany('App/Surface'); } }
My problem is that when I call $address->surfaces , I get the following error:
Argument 1 passed to App\Surface::__construct() must be an instance of App\Repositories\ZipCodeRepositoryInterface, none given
I thought IoC would automatically add this.
source share