Last active
January 25, 2018 17:54
-
-
Save davidchc/269d85099eb03a392e6dbbabb65612eb 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\Models; | |
use Illuminate\Database\Eloquent\Model; | |
class Post extends Model | |
{ | |
} |
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\Repositories\Contracts; | |
interface PostRepositoryInterface | |
{ | |
public function save($data); | |
public function getPosts(); | |
public function getPost($id); | |
public function delete($id); | |
public function getPostWhereSlug($slug); | |
} |
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\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