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

35 lines
780 B
PHP

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