@@ -2,7 +2,24 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class InvestmentZone extends DomainRecord
|
||||
{
|
||||
protected $casts = ['version_no' => 'integer', 'published_at' => 'datetime'];
|
||||
protected $casts = ['version_no' => 'integer', 'published_at' => 'datetime', 'aliases' => 'array', 'activities' => 'array', 'resources' => 'array', 'historical_territory' => 'array', 'area_components' => 'array', 'source_evidence' => 'array', 'area_value' => 'decimal:4', 'data_as_of' => 'date', 'sources_consulted_at' => 'date'];
|
||||
|
||||
/** @return BelongsTo<GeoLocation, $this> */
|
||||
public function primaryTerritory(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(GeoLocation::class, 'primary_territory_id');
|
||||
}
|
||||
|
||||
/** @return BelongsToMany<GeoLocation, $this> */
|
||||
public function documentedLocations(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(GeoLocation::class, 'investment_zone_locations', 'zone_id', 'geo_location_id')
|
||||
->withPivot(['id', 'scope_type', 'source_reference', 'legal_source_id', 'valid_from', 'valid_until', 'validation_status', 'editor_id', 'reviewer_id', 'version_no'])
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user