Feature #3 : Districts
This commit is contained in:
20
app/Models/District.php
Normal file
20
app/Models/District.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Location\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Modules\Location\Database\Factories\DistrictFactory;
|
||||
|
||||
class District extends Base
|
||||
{
|
||||
protected $fillable = ['province_code','city_code', 'code', 'name'];
|
||||
|
||||
public function city(){
|
||||
return $this->belongsTo(City::class, 'city_code', 'code');
|
||||
}
|
||||
|
||||
public function villages(){
|
||||
return $this->hasMany(Village::class, 'district_code', 'code');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user