31 lines
694 B
PHP
31 lines
694 B
PHP
<?php
|
|
|
|
namespace App\Repositories;
|
|
|
|
use App\Models\News;
|
|
use App\Repositories\Interface\NewsInterface;
|
|
|
|
class NewsRepository implements NewsInterface
|
|
{
|
|
public function getAll()
|
|
{
|
|
return News::where('status', '<>', -1)->orderBy('display_order')->get();
|
|
}
|
|
public function getNewsById($newsId)
|
|
{
|
|
return News::findOrFail($newsId);
|
|
}
|
|
public function delete($newsId)
|
|
{
|
|
return News::destroy($newsId);
|
|
}
|
|
public function create(array $newsDetail)
|
|
{
|
|
return News::create($newsDetail);
|
|
}
|
|
public function update($newsId, array $newDetails)
|
|
{
|
|
return News::where('news_id', $newsId)->update($newDetails);
|
|
}
|
|
}
|