Skip to content

Instantly share code, notes, and snippets.

@JeffreyWay
Last active February 25, 2019 01:36
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save JeffreyWay/5438984 to your computer and use it in GitHub Desktop.
Save JeffreyWay/5438984 to your computer and use it in GitHub Desktop.
Laravel challenge / poll for book.

Challenge: you need a flexible (swap in other repository implementations) way to display some kind of resource. Let's say, Posts. What does your folder structure look like?

Requirements:

  • Repository implements an interface
  • Must show at least one implementation of the interface (Eloquent version is fine)
  • The interface is injected into your PostsController.
  • Show where you register your IoC bindings
  • Show folder structure. Where are interfaces/repositories stored?
@williamcolbert
Copy link

Love this challenge actually helping me with getting into abstraction.

But one question I have is , I see alot of people implementing for instance in this version posted, the Post class extending eloquent shouldn't this Post class be a entity that just defines what the Post is made up of and function to act on the entity and not extending Eloquent ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment