Edit File: City.php
<?php namespace App\Models; use App\Traits\ModelTrait; use Illuminate\Database\Eloquent\Relations\BelongsTo; use Spatie\Translatable\HasTranslations; class City extends BaseModel { use HasTranslations, ModelTrait; protected $fillable = ['name', 'country_id']; public $translatable = ['name']; protected $with = ['country']; /** * Get the country that owns the City * * @return BelongsTo */ public function country(): BelongsTo { return $this->belongsTo(Country::class, 'country_id', 'id'); } }
Back to File Manager