Created
June 7, 2020 02:41
-
-
Save misaki1301/47235dba18d370804c9c0f7a92e92d91 to your computer and use it in GitHub Desktop.
This file contains hidden or 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\Models\Anime; | |
use App\Models\Character; | |
use App\Repositories\Interfaces\CharacterRepositoryInterface; | |
class CharacterRepository implements CharacterRepositoryInterface | |
{ | |
public function all() | |
{ | |
return Character::all(); | |
} | |
public function getByAnime(Anime $anime) | |
{ | |
return Character::where('anime.id'.$anime.id)->get(); | |
} | |
public function create(Character $character) | |
{ | |
$character->save(); | |
return $character; | |
} | |
public function getById($id) | |
{ | |
// TODO: Implement getById() method. | |
} | |
public function update($id, Character $character) | |
{ | |
// TODO: Implement update() method. | |
} | |
public function delete($id) | |
{ | |
return Character::destroy($id) ? true : false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment