Skip to content

Instantly share code, notes, and snippets.

@davidchc
Last active January 25, 2018 17:54
Show Gist options
  • Save davidchc/269d85099eb03a392e6dbbabb65612eb to your computer and use it in GitHub Desktop.
Save davidchc/269d85099eb03a392e6dbbabb65612eb to your computer and use it in GitHub Desktop.
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Post extends Model
{
}
<?php
namespace App\Repositories\Contracts;
interface PostRepositoryInterface
{
public function save($data);
public function getPosts();
public function getPost($id);
public function delete($id);
public function getPostWhereSlug($slug);
}
<?php
namespace App\Repositories;
use App\Repositories\Contracts\PostRepositoryInterface;
use App\Models\Post;
class PostRepositoryEloquent implements PostRepositoryInterface
{
public function save($data)
{
}
public function getPosts()
{
}
public function getPost($id)
{
return Post::find($id);
}
public function delete($id)
{
}
public function getPostWhereSlug($slug)
{
return Post::where('slug', $slug)->first();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment