New-OMIS/app/Models/Country/Country.php

29 lines
582 B
PHP
Raw Normal View History

2024-04-05 05:22:15 +00:00
<?php
2024-04-07 07:28:58 +00:00
namespace App\Models\Country;
2024-04-05 05:22:15 +00:00
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Country extends Model
{
use HasFactory;
2024-04-07 07:28:58 +00:00
protected $table = 'tbl_countries';
2024-04-05 05:22:15 +00:00
protected $fillable = [
'country_name',
'phone_code',
'country_code',
2024-04-07 07:28:58 +00:00
'status',
2024-04-05 05:22:15 +00:00
];
public function provinces()
{
return $this->hasMany(Province::class);
}
public static function getCountries()
{
2024-04-07 07:28:58 +00:00
return self::select('id', 'country_name')->where('status', 'Active')->get();
2024-04-05 05:22:15 +00:00
}
}