Skip to content

Company ​

File: src/Entities/Company.php
Namespace: Unusualify\Modularous\Entities
Extends: Model
Traits: HasFactory, HasSpreadable

Organisation/company record. Users belong to a company, which holds billing and address information. Supports the HasSpreadable trait for extending fields dynamically via JSON.

Fillable Attributes ​

AttributeTypeDescription
namestringCompany name
addressstringStreet address
citystringCity
statestringState/province
country_idintCountry reference
zip_codestringPostal code
phonestringPhone number
vat_numberstringVAT number
tax_idstringTax ID

Relationships ​

users(): HasMany ​

All users belonging to this company.

country(): BelongsTo ​

The company's country (from SystemUtility module).

paymentCountry(): BelongsTo ​

Payment-specific country record (from SystemPayment module), resolved via country_id.

Accessors ​

AccessorTypeDescription
country_namestring|nullCountry display name
company_typestring'personal' or 'corporate' (derived from spread is_personal flag)
is_personal_companyboolWhether the company is a personal account
is_corporate_companyboolWhether the company is corporate
is_validboolWhether all required billing fields are filled
is_valid_formattedstringHTML chip showing Yes/No validation status

Validation ​

The is_valid accessor checks different required fields based on company type:

  • Personal: address, city, state, zip_code, country_id
  • Corporate: name, tax_id, email, address, country_id, city, state, zip_code