master_template/app/Repositories/AuthorRepository.php

35 lines
735 B
PHP
Raw Normal View History

2024-06-15 16:38:54 +00:00
<?php
namespace App\Repositories;
2024-06-23 11:17:56 +00:00
use App\Repositories\AuthorsInterface;
2024-06-15 16:38:54 +00:00
use App\Models\Authors;
class AuthorRepository implements AuthorsInterface
{
public function getAll()
{
return Authors::where('status', '<>', -1)->orderBy('display_order')->get();
}
public function getAuthorsById($authorId)
{
return Authors::findOrFail($authorId);
}
public function delete($authorId)
{
return Authors::destroy($authorId);
}
public function create(array $authorDetail)
{
return Authors::create($authorDetail);
}
public function update($authorId, array $newDetails)
{
return Authors::where('author_id', $authorId)->update($newDetails);
}
}