✏️ Edit: Country.php
Path:
/home/thiqat5/electronics.thiqatech.com/platform/plugins/location/src/Models/Country.php
Size: 981 B · Modified: 2022-04-22 10:13:56 · Perm: 0644 · Writable
← Back to directory
👁 View
⬇ Download
<?php namespace Botble\Location\Models; use Botble\Base\Traits\EnumCastable; use Botble\Base\Enums\BaseStatusEnum; use Botble\Base\Models\BaseModel; class Country extends BaseModel { use EnumCastable; /** * The database table used by the model. * * @var string */ protected $table = 'countries'; /** * @var array */ protected $fillable = [ 'name', 'nationality', 'code', 'order', 'is_default', 'status', ]; /** * @var array */ protected $casts = [ 'status' => BaseStatusEnum::class, ]; protected static function boot() { parent::boot(); static::deleting(function (Country $country) { $states = State::get(); foreach ($states as $state) { State::where('id', $state->id)->delete(); } City::where('country_id', $country->id)->delete(); }); } }
💾 Save
Cancel
Save as UTF-8, newlines normalized to LF