addMediaCollection('main'); } /** * Media conversations */ public function registerMediaConversions(?Media $media = null): void { $this->addMediaConversion('thumb150x150') ->fit(Manipulations::FIT_CONTAIN, 150, 150); } /** * User */ public function user(): BelongsTo { return $this->belongsTo(User::class); } /** * Entrepreneurship types * * ENTREPRENEUR */ public const ENTREPRENEUR = 'tel'; /** * PRIVATE ENTERPRISE */ public const PRIVATE_ENTERPRISE = 'hk'; /** * PARTNERSHIP ENTERPRISE */ public const PARTNERSHIP_ENTERPRISE = 'hj'; /** * Government */ public const GOVERNMENT = 'gov'; /** * Closed joint stock */ public const CLOSED_JOINT_STOCK = 'closed_joint_stock'; /** * Open joint stock */ public const OPEN_JOINT_STOCK = 'open_joint_stock'; /** * Corparation types */ public static function corparationTypes(): array { return [ self::ENTREPRENEUR => __('Entrepreneur'), self::PRIVATE_ENTERPRISE => __('Private enterprise'), self::PARTNERSHIP_ENTERPRISE => __('Partnership enterprise'), self::GOVERNMENT => __('Government company'), self::CLOSED_JOINT_STOCK => __('Closed joint stock company'), self::OPEN_JOINT_STOCK => __('Open joint-stock company'), ]; } /** * Formatted corparation type */ public function formattedCorparationType(): Attribute { return Attribute::make( get: fn () => self::corparationTypes()[$this->corporation_type] ?? '' ); } /** * Formatted corparation name */ public function formattedCorparationName(): Attribute { return Attribute::make( get: fn () => $this->formattedCorparationType.' '.$this->corporation_name ); } }