Skip to content

Instantly share code, notes, and snippets.

@lmichailian
Created July 24, 2017 11:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lmichailian/45464806cfaac7a9a5fe2ae4885fb76e to your computer and use it in GitHub Desktop.
Save lmichailian/45464806cfaac7a9a5fe2ae4885fb76e to your computer and use it in GitHub Desktop.
complex php
<?php
class PostController
{
public function __construct(PostRepository $postRepository)
{
$this->postRepository = $postRepository;
}
public function index()
{
return $this->postRepository()->getAll();
}
}
interface PostRepository
{
public function getAll();
}
class EloquentPostRepository implements PostRepository
{
public function getAll()
{
reutrn Post::all();
}
}
app()->bind(PostRepository::class, EloquertPostRepository::class);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment