New-OMIS/app/Models/District.php
2024-04-07 17:59:05 +05:45

38 lines
1.0 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class District extends Model
{
use HasFactory;
protected $fillable = [
'district_name',
'country_id',
'province_id',
'status',
];
public static function getDistricts()
{
return self::select('id', 'district_name')->where('status', 'Active')->get();
}
public static function getDistrictsByProvinceId($province_id)
{
return self::select('id', 'district_name')->where('status', 'Active')->where('state_id',$province_id)->get();
}
public static function getPermDistrictsByProvinceId($province_id)
{
return self::select('id', 'district_name')->where('status', 'Active')->where('state_id',$province_id)->get();
}
public static function getTempDistrictsByProvinceId($province_id)
{
return self::select('id', 'district_name')->where('status', 'Active')->where('state_id',$province_id)->get();
}
}