diff --git a/app/Models/Building.php b/app/Models/Building.php index f0e7773..34a6c06 100755 --- a/app/Models/Building.php +++ b/app/Models/Building.php @@ -3,6 +3,7 @@ namespace Modules\Realestate\Models; use Modules\Base\Models\BaseModel; +use Modules\Realestate\Models\Estate; class Building extends BaseModel { @@ -20,4 +21,13 @@ class Building extends BaseModel */ protected $table = "realestate_building"; + /** + * Add relationship to Estate + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function estate() + { + return $this->belongsTo(Estate::class); + } + } diff --git a/app/Models/BuildingUnitSetup.php b/app/Models/BuildingUnitSetup.php index c7e2a60..e751c7a 100755 --- a/app/Models/BuildingUnitSetup.php +++ b/app/Models/BuildingUnitSetup.php @@ -3,6 +3,7 @@ namespace Modules\Realestate\Models; use Modules\Base\Models\BaseModel; +use Modules\Realestate\Models\Building; class BuildingUnitSetup extends BaseModel { @@ -20,4 +21,13 @@ class BuildingUnitSetup extends BaseModel */ protected $table = "realestate_building_unit_setup"; + /** + * Add relationship to Building + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function building() + { + return $this->belongsTo(Building::class); + } + } diff --git a/app/Models/Estate.php b/app/Models/Estate.php index dce4594..13c7de5 100755 --- a/app/Models/Estate.php +++ b/app/Models/Estate.php @@ -3,6 +3,7 @@ namespace Modules\Realestate\Models; use Modules\Base\Models\BaseModel; +use Modules\Realestate\Models\Town; class Estate extends BaseModel { @@ -20,4 +21,13 @@ class Estate extends BaseModel */ protected $table = "realestate_estate"; + /** + * Add relationship to Town + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function town() + { + return $this->belongsTo(Town::class); + } + } diff --git a/app/Models/ReadingElectricity.php b/app/Models/ReadingElectricity.php index 0d16925..192560e 100755 --- a/app/Models/ReadingElectricity.php +++ b/app/Models/ReadingElectricity.php @@ -2,7 +2,9 @@ namespace Modules\Realestate\Models; +use Modules\Account\Models\Invoice; use Modules\Base\Models\BaseModel; +use Modules\Realestate\Models\Tenancy; class ReadingElectricity extends BaseModel { @@ -21,4 +23,22 @@ class ReadingElectricity extends BaseModel */ protected $table = "realestate_reading_electricity"; + /** + * Add relationship to Tenancy + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function tenancy() + { + return $this->belongsTo(Tenancy::class); + } + + /** + * Add relationship to Invoice + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function invoice() + { + return $this->belongsTo(Invoice::class); + } + } diff --git a/app/Models/ReadingGas.php b/app/Models/ReadingGas.php index 6112e22..45ab8f9 100755 --- a/app/Models/ReadingGas.php +++ b/app/Models/ReadingGas.php @@ -2,7 +2,9 @@ namespace Modules\Realestate\Models; +use Modules\Account\Models\Invoice; use Modules\Base\Models\BaseModel; +use Modules\Realestate\Models\Tenancy; class ReadingGas extends BaseModel { @@ -20,4 +22,22 @@ class ReadingGas extends BaseModel */ protected $table = "realestate_reading_gas"; + /** + * Add relationship to Tenancy + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function tenancy() + { + return $this->belongsTo(Tenancy::class); + } + + /** + * Add relationship to Invoice + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function invoice() + { + return $this->belongsTo(Invoice::class); + } + } diff --git a/app/Models/ReadingWater.php b/app/Models/ReadingWater.php index 5cb295b..5f7f384 100755 --- a/app/Models/ReadingWater.php +++ b/app/Models/ReadingWater.php @@ -2,7 +2,9 @@ namespace Modules\Realestate\Models; +use Modules\Account\Models\Invoice; use Modules\Base\Models\BaseModel; +use Modules\Realestate\Models\Tenancy; class ReadingWater extends BaseModel { @@ -20,4 +22,22 @@ class ReadingWater extends BaseModel */ protected $table = "realestate_reading_water"; + /** + * Add relationship to Tenancy + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function tenancy() + { + return $this->belongsTo(Tenancy::class); + } + + /** + * Add relationship to Invoice + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function invoice() + { + return $this->belongsTo(Invoice::class); + } + } diff --git a/app/Models/Region.php b/app/Models/Region.php index 147b7e8..029302e 100755 --- a/app/Models/Region.php +++ b/app/Models/Region.php @@ -3,6 +3,8 @@ namespace Modules\Realestate\Models; use Modules\Base\Models\BaseModel; +use Modules\Core\Models\Country; +use Modules\Realestate\Models\State; class Region extends BaseModel { @@ -20,4 +22,22 @@ class Region extends BaseModel */ protected $table = "realestate_region"; + /** + * Add relationship to Country + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function country() + { + return $this->belongsTo(Country::class); + } + + /** + * Add relationship to State + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function state() + { + return $this->belongsTo(State::class); + } + } diff --git a/app/Models/Tenancy.php b/app/Models/Tenancy.php index 466d87c..75f13ba 100755 --- a/app/Models/Tenancy.php +++ b/app/Models/Tenancy.php @@ -3,6 +3,8 @@ namespace Modules\Realestate\Models; use Modules\Base\Models\BaseModel; +use Modules\Partner\Models\Partner; +use Modules\Realestate\Models\Unit; class Tenancy extends BaseModel { @@ -20,4 +22,22 @@ class Tenancy extends BaseModel */ protected $table = "realestate_tenancy"; + /** + * Add relationship to Unit + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function unit() + { + return $this->belongsTo(Unit::class); + } + + /** + * Add relationship to Partner + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function partner() + { + return $this->belongsTo(Partner::class); + } + } diff --git a/app/Models/TenancyInvoice.php b/app/Models/TenancyInvoice.php index 68e761f..a813a7d 100755 --- a/app/Models/TenancyInvoice.php +++ b/app/Models/TenancyInvoice.php @@ -2,7 +2,9 @@ namespace Modules\Realestate\Models; +use Modules\Account\Models\Invoice; use Modules\Base\Models\BaseModel; +use Modules\Realestate\Models\Tenancy; class TenancyInvoice extends BaseModel { @@ -20,4 +22,22 @@ class TenancyInvoice extends BaseModel */ protected $table = "realestate_tenancy_invoice"; + /** + * Add relationship to Tenancy + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function tenancy() + { + return $this->belongsTo(Tenancy::class); + } + + /** + * Add relationship to Invoice + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function invoice() + { + return $this->belongsTo(Invoice::class); + } + } diff --git a/app/Models/TenancyService.php b/app/Models/TenancyService.php index 46a3041..981efe0 100755 --- a/app/Models/TenancyService.php +++ b/app/Models/TenancyService.php @@ -3,6 +3,7 @@ namespace Modules\Realestate\Models; use Modules\Base\Models\BaseModel; +use Modules\Realestate\Models\Tenancy; class TenancyService extends BaseModel { @@ -20,4 +21,13 @@ class TenancyService extends BaseModel */ protected $table = "realestate_tenancy_service"; + /** + * Add relationship to Tenancy + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function tenancy() + { + return $this->belongsTo(Tenancy::class); + } + } diff --git a/app/Models/Town.php b/app/Models/Town.php index 71c2336..eab1920 100755 --- a/app/Models/Town.php +++ b/app/Models/Town.php @@ -3,6 +3,7 @@ namespace Modules\Realestate\Models; use Modules\Base\Models\BaseModel; +use Modules\Realestate\Models\Region; class Town extends BaseModel { @@ -20,4 +21,13 @@ class Town extends BaseModel */ protected $table = "realestate_town"; + /** + * Add relationship to Region + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function region() + { + return $this->belongsTo(Region::class); + } + } diff --git a/app/Models/Unit.php b/app/Models/Unit.php index 3464cdb..fafbd91 100755 --- a/app/Models/Unit.php +++ b/app/Models/Unit.php @@ -3,6 +3,7 @@ namespace Modules\Realestate\Models; use Modules\Base\Models\BaseModel; +use Modules\Realestate\Models\Building; class Unit extends BaseModel { @@ -20,4 +21,13 @@ class Unit extends BaseModel */ protected $table = "realestate_unit"; + /** + * Add relationship to Building + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function building() + { + return $this->belongsTo(Building::class); + } + } diff --git a/app/Models/UnitSetup.php b/app/Models/UnitSetup.php index 1799b36..1eaa584 100755 --- a/app/Models/UnitSetup.php +++ b/app/Models/UnitSetup.php @@ -3,6 +3,7 @@ namespace Modules\Realestate\Models; use Modules\Base\Models\BaseModel; +use Modules\Realestate\Models\Unit; class UnitSetup extends BaseModel { @@ -20,4 +21,13 @@ class UnitSetup extends BaseModel */ protected $table = "realestate_unit_setup"; + /** + * Add relationship to Unit + * @return \Illuminate\Database\Eloquent\Relations\BelongsTo + */ + public function unit() + { + return $this->belongsTo(Unit::class); + } + }