master_template/app/Repositories/NewsCategoriesRepository.php

31 lines
858 B
PHP
Raw Normal View History

2024-06-15 16:38:54 +00:00
<?php
namespace App\Repositories;
use App\Models\Newscategories;
2024-06-23 11:17:56 +00:00
use App\Repositories\NewsCategoriesInterface;
2024-06-15 16:38:54 +00:00
class NewsCategoriesRepository implements NewsCategoriesInterface
{
public function getAll()
{
return Newscategories::where('status', '<>', -1)->orderBy('display_order')->get();
}
public function getNewsCategoriesById($newsCategoriesId)
{
return Newscategories::findOrFail($newsCategoriesId);
}
public function delete($newsCategoriesId)
{
return Newscategories::destroy($newsCategoriesId);
}
public function create(array $provinceDetails)
{
return Newscategories::create($provinceDetails);
}
public function update($newsCategoriesId, array $newDetails)
{
return Newscategories::where('category_id', $newsCategoriesId)->update($newDetails);
}
}