master_template/app/Repositories/ArticleRepository.php

36 lines
766 B
PHP
Raw Normal View History

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