master_template/app/Repositories/ArticleRepository.php
2024-06-23 17:02:56 +05:45

36 lines
756 B
PHP

<?php
namespace App\Repositories;
use App\Models\Articles;
use App\Repositories\ArticleInterface;
class ArticleRepository implements ArticleInterface
{
public function getAll()
{
return Articles::where('status', '<>', -1)->orderBy('display_order')->get();
}
public function getArticleById($artilceId)
{
return Articles::findOrFail($artilceId);
}
public function delete($artilceId)
{
return Articles::destroy($artilceId);
}
public function create(array $provinceDetails)
{
return Articles::create($provinceDetails);
}
public function update($artilceId, array $newDetails)
{
return Articles::where('article_id', $artilceId)->update($newDetails);
}
}