master_template/app/Repositories/ProvinceRepository.php

35 lines
770 B
PHP
Raw Normal View History

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