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

29 lines
582 B
PHP
Raw Normal View History

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