36 lines
766 B
PHP
36 lines
766 B
PHP
|
<?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);
|
||
|
}
|
||
|
}
|