master_template/app/Repositories/NewsCategoriesRepository.php
2024-06-15 22:23:54 +05:45

31 lines
868 B
PHP

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