'aliases' => array(
...
'Categories' => 'Shopavel\Categories\Facades\Categories',
);
use Shopavel\Categories\Category;
$category = Category::find(1);
foreach ($category->products() as $product)
{
// ...
}
You can use the facade to access the repository methods:
// Returns a products repository restricted to those within the category
Categories::products($category_id);
You can alter the query using methods from the product repository, and other default query builder methods:
Categories::products($category_id)->bestselling()->take(10);
All Shopavel packages are open-sourced software licensed under the MIT license