Last active
May 4, 2017 08:55
-
-
Save danjohnson95/fa48d4c45a6c289841612344697978ea to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php namespace App\Http\Controllers; | |
use App\Repos\ProductRepository; | |
class ProductController extends Controller | |
{ | |
/** | |
* An instance of the Product Repository | |
* @var \App\Repos\ProductRepository | |
*/ | |
protected $repo; | |
/** | |
* Injects the dependency | |
* @param \App\Repos\ProductRepository $repo | |
*/ | |
public function __construct(ProductRepository $repo) | |
{ | |
$this->repo = $repo; | |
} | |
/** | |
* Gets a product by the ID | |
* @param int $id | |
* @return \Illuminate\View\View | |
*/ | |
public function show($id) | |
{ | |
$product = $this->repo->findById($id); | |
return view('product', $product); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment