Skip to content

Instantly share code, notes, and snippets.

@MrAtiebatie
Created September 11, 2019 12:41
Show Gist options
  • Save MrAtiebatie/bf647e982f5b45e56dee3c0e4d5e96e2 to your computer and use it in GitHub Desktop.
Save MrAtiebatie/bf647e982f5b45e56dee3c0e4d5e96e2 to your computer and use it in GitHub Desktop.
<?php
/**
* In your routes/web.php
*/
$router->get('/', function (\App\Repositories\ProductRepository $productRepo) {
// Use any Eloquent feature directly
$productRepo->all()->dd();
// Use your custom repository methods
echo $productRepo->findBySku(12345)->name;
// You can even query relations
echo $productRepo->first()->category;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment