Skip to content

Instantly share code, notes, and snippets.

@misaki1301
Created June 7, 2020 02:41
Show Gist options
  • Save misaki1301/47235dba18d370804c9c0f7a92e92d91 to your computer and use it in GitHub Desktop.
Save misaki1301/47235dba18d370804c9c0f7a92e92d91 to your computer and use it in GitHub Desktop.
<?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