master_template/app/Repositories/NewsCategoriesRepository.php
2024-06-23 17:02:56 +05:45

31 lines
858 B
PHP

<?php
namespace App\Repositories;
use App\Models\Newscategories;
use App\Repositories\NewsCategoriesInterface;
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);
}
}