master_template/app/Repositories/ArticleRepository.php

36 lines
756 B
PHP
Raw Normal View History

2024-06-18 05:46:51 +00:00
<?php
namespace App\Repositories;
use App\Models\Articles;
2024-06-23 11:17:56 +00:00
use App\Repositories\ArticleInterface;
2024-06-18 05:46:51 +00:00
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);
}
}