| 1234567891011121314151617181920212223242526272829303132333435363738 |
- <?php
- namespace App\Models;
- use App\Enums\DefaultStatusEnum;
- use Illuminate\Database\Eloquent\Factories\HasFactory;
- use Illuminate\Database\Eloquent\Model;
- class City extends Model
- {
- use HasFactory;
- protected $table = 'cities';
- protected $guarded = ['id'];
- /**
- * Get the attributes that should be cast.
- *
- * @return array<string, string>
- */
- protected function casts(): array
- {
- return [
- 'status' => DefaultStatusEnum::class,
- ];
- }
- public function country()
- {
- return $this->belongsTo(Country::class, 'country_id');
- }
- public function state()
- {
- return $this->belongsTo(State::class, 'state_id');
- }
- }
|