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

35 lines
770 B
PHP

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