false, 'sort' => 100, ]; /** * The attributes that are mass assignable. * * @var array */ protected $fillable = [ 'title', 'code', 'is_default', 'sort', 'system_lang', 'iso_code', ]; /** * Get the attributes that should be cast. * * @return array */ protected function casts(): array { return [ 'is_default' => 'boolean', 'sort' => 'integer', 'system_lang' => Lang::class, ]; } protected function attributeLang(): Attribute { return Attribute::make( get: function () { if ($this->iso_code) { return $this->iso_code; } if ($this->system_lang) { return $this->system_lang->getLocale(); } return $this->code; }, )->shouldCache(); } public function serviceTranslate(): HasOne { return $this->hasOne(ProjectTranslationService::class, 'language_id', 'id'); } }