working on omis setup
This commit is contained in:
30
app/Models/Province.php
Normal file
30
app/Models/Province.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Province extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
protected $fillable = [
|
||||
'province_name',
|
||||
'country_id',
|
||||
'status',
|
||||
];
|
||||
public function country()
|
||||
{
|
||||
return $this->belongsTo(Country::class);
|
||||
}
|
||||
|
||||
public static function getProvinces()
|
||||
{
|
||||
return self::select('id','province_name')->where('status','Active')->get();
|
||||
}
|
||||
|
||||
public static function getProvincesByCountryId($country_id)
|
||||
{
|
||||
return self::select('id','province_name')->where('status','Active')->where('country_id',$country_id)->get();
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user