I am using the IoC container in Laravel, I am trying to grab all the data from my database
<?php namespace API;
class ProductRepository implements ProductRepositoryInterface {
public function getProducts()
{
return Product::all();
}
}
When I run this I get this error
Symfony \ Component \ Debug \ Exception \ FatalErrorException
Class 'API\Product' not found
I am guessing it is trying to find the Product model in the API folder which I have namespaced. My question is how do I get my application to know that Product:all()
should use the Product model. Is my name spacing correct? ProductRespository is sitting inside a folder called API.