A product group

A product group contains one or more order-able products and determines how those products are displayed in order forms to clients.

class Group extends AbstractModel

Constants

INVALID_EMPTY

INVALID_HYPHEN

INVALID_NUMERIC

Properties summary

Type Property Description
protected $table
protected $columnMap
protected $booleans
protected $commaSeparated
int $id A product group's unique identifier.
string $name A product group's name.
string $slug A product group's slug.
string $headline A product group's headline.
string $tagline A product group's tagline.
string $orderFormTemplate The order form template a product group should display on the order form, or null to use the default shopping cart template.
string[] $disabledPaymentGateways Payment gateways which should NOT be displayed to the client when ordering products in a product group.
bool $isHidden Whether or not a product group is displayed to clients in the shopping cart.
int $displayOrder The order in which a product group is displayed to clients.
Carbon $createdAt The date a product group was created.
Carbon $updatedAt The date a product group was last modified.
Collection|Product[] $products The products that belong to a product group.
Collection|Feature[] $features The products that belong to a product group.
Collection|DynamicTranslation[] $translatedNames
Collection|DynamicTranslation[] $translatedHeadlines
Collection|DynamicTranslation[] $translatedTaglines

Methods summary

Return Type Method Name Description
static  boot() -
HasMany products() A product group has many products in it.
HasMany features() A product group can have many features.
Builder scopeSlug($query, $slug) Find by slug.
Builder scopeNotHidden($query) Restrict to groups which are publicly visible.
Builder scopeSorted($query) Sort by display order.
string getRoutePath(bool $fullUrl = false) Get client area route path for group.
bool validateSlugIsUnique(string $slug) Validate slug is unique.
bool validateSlugFormat(string $slug) Ensure slug is in a valid format for use.
string; autoGenerateUniqueSlug() Auto generate unique slug based on name.
OrderForm orderFormTemplate() Retrieve a product group's associated order form
HasMany|DynamicTranslation[] translatedNames() Return the translated names for the specific product
HasMany|DynamicTranslation[] translatedHeadlines() Return the translated headlines for the specific product
HasMany|DynamicTranslation[] translatedTaglines() Return the translated taglines for the specific product
string getNameAttribute(string $name) Get the group's name - this will override the output from the db value if set in Lang.
string getHeadlineAttribute(string $headline) Get the group's headline - this will override the output from the db value if set in Lang.
string getTaglineAttribute(string $tagline) Get the group's tagline - this will override the output from the db value if set in Lang.
static string getGroupName(int $groupId, string $fallback = '', string $language = null) Obtain the product group name for the current language, passed language or fallback to the currently defined value for the product group.
static string getHeadline(int $groupId, string $fallback = '', string $language = null) Obtain the product headline for the current language, passed language or fallback to the currently defined value for the product group.
static string getTagline(int $groupId, string $fallback = '', string $language = null) Obtain the product tagline for the current language, passed language or fallback to the currently defined value for the product group.
bool isMarketConnectGroup() -
string getMarketConnectControllerClass() -

Details

static boot ()

HasMany products ()

A product group has many products in it.

Return Value

HasMany

HasMany features ()

A product group can have many features.

Return Value

HasMany

Builder scopeSlug ($query, $slug)

Find by slug.

Parameters

$query
$slug

Return Value

Builder

Builder scopeNotHidden ($query)

Restrict to groups which are publicly visible.

Parameters

$query

Return Value

Builder

Builder scopeSorted ($query)

Sort by display order.

Parameters

$query

Return Value

Builder

string getRoutePath (bool $fullUrl = false)

Get client area route path for group.

Parameters

bool $fullUrl

Return Value

string

bool validateSlugIsUnique (string $slug)

Validate slug is unique.

Parameters

string $slug

Return Value

bool

Exceptions

InvalidValue

bool validateSlugFormat (string $slug)

Ensure slug is in a valid format for use.

Parameters

string $slug

Return Value

bool

Exceptions

InvalidValue

string; autoGenerateUniqueSlug ()

Auto generate unique slug based on name.

Return Value

string;

OrderForm orderFormTemplate ()

Retrieve a product group's associated order form

Use the default template if the product group doesn't have an associated order form.

Return Value

OrderForm

HasMany|DynamicTranslation[] translatedNames ()

Return the translated names for the specific product

Return Value

HasMany|DynamicTranslation[]

HasMany|DynamicTranslation[] translatedHeadlines ()

Return the translated headlines for the specific product

Return Value

HasMany|DynamicTranslation[]

HasMany|DynamicTranslation[] translatedTaglines ()

Return the translated taglines for the specific product

Return Value

HasMany|DynamicTranslation[]

string getNameAttribute (string $name)

Get the group's name - this will override the output from the db value if set in Lang.

Parameters

string $name The value from the database

Return Value

string

string getHeadlineAttribute (string $headline)

Get the group's headline - this will override the output from the db value if set in Lang.

Parameters

string $headline The value from the database

Return Value

string

string getTaglineAttribute (string $tagline)

Get the group's tagline - this will override the output from the db value if set in Lang.

Parameters

string $tagline The value from the database

Return Value

string

static string getGroupName (int $groupId, string $fallback = '', string $language = null)

Obtain the product group name for the current language, passed language or fallback to the currently defined value for the product group.

Parameters

int $groupId
string $fallback
string $language

Return Value

string

static string getHeadline (int $groupId, string $fallback = '', string $language = null)

Obtain the product headline for the current language, passed language or fallback to the currently defined value for the product group.

Parameters

int $groupId
string $fallback
string $language

Return Value

string

static string getTagline (int $groupId, string $fallback = '', string $language = null)

Obtain the product tagline for the current language, passed language or fallback to the currently defined value for the product group.

Parameters

int $groupId
string $fallback
string $language

Return Value

string

bool isMarketConnectGroup ()

Return Value

bool

string getMarketConnectControllerClass ()

Return Value

string

Exceptions

InvalidValue
Exception