X7ROOT File Manager
Current Path:
/home/gfecatvj/sites/restate/platform/plugins/location/src/Models
home
/
gfecatvj
/
sites
/
restate
/
platform
/
plugins
/
location
/
src
/
Models
/
📁
..
📄
City.php
(990 B)
📄
Country.php
(965 B)
📄
State.php
(1 KB)
Editing: State.php
<?php namespace Botble\Location\Models; use Botble\Base\Traits\EnumCastable; use Botble\Base\Enums\BaseStatusEnum; use Botble\Base\Models\BaseModel; use Illuminate\Database\Eloquent\Relations\BelongsTo; class State extends BaseModel { use EnumCastable; /** * The database table used by the model. * * @var string */ protected $table = 'states'; /** * @var array */ protected $fillable = [ 'name', 'abbreviation', 'country_id', 'order', 'is_default', 'status', ]; /** * @var array */ protected $casts = [ 'status' => BaseStatusEnum::class, ]; /** * @return BelongsTo */ public function country() { return $this->belongsTo(Country::class)->withDefault(); } protected static function boot() { parent::boot(); static::deleting(function (State $state) { City::where('state_id', $state->id)->delete(); }); } }
Upload File
Create Folder