PHP Трейт Stevebauman\Inventory\Traits\InventoryVariantTrait

Показать файл Открыть проект

Открытые методы

Метод Описание
createVariant ( string $name = '', string $description = '', integer | string $categoryId = null, integer | string $metricId = null ) : boolean | Model Creates a new variant instance, saves it, and returns the resulting variant.
getParent ( ) : Model Returns the parent item record for the current variant.
getTotalVariantStock ( boolean $recursive = true ) : integer | float Returns the total sum of the item variants stock. This method is recursive by default, and includes variants of variants total stock.
getVariants ( boolean $recursive = false ) : Illuminate\Database\Eloquent\Collection Returns all variants of the current item.
hasVariants ( ) : boolean Returns true / false if the current item has variants.
isVariant ( ) : boolean Returns true / false if the current item is a variant of another item.
makeVariantOf ( Model $item ) Makes the current item a variant of the specified item.
newVariant ( string $name = '' ) : Model Returns a new Inventory model instance with it's parent ID, category ID, and metric ID set to the current item's for the creation of a variant.
parent ( ) : BelongsTo The belongsTo parent relationship.
variants ( ) : Illuminate\Database\Eloquent\Relations\HasMany The hasMany variants relationship.
variantsRecursive ( ) : Illuminate\Database\Eloquent\Relations\HasMany The hasMany recursive variants relationship.

Защищенные методы

Метод Описание
processMakeVariant ( integer | string $itemId ) Processes making the current item a variant of the specified item ID.

Описание методов

createVariant() публичный Метод

Creates a new variant instance, saves it, and returns the resulting variant.
public createVariant ( string $name = '', string $description = '', integer | string $categoryId = null, integer | string $metricId = null ) : boolean | Model
$name string
$description string
$categoryId integer | string
$metricId integer | string
Результат boolean | Illuminate\Database\Eloquent\Model

getParent() публичный Метод

Returns the parent item record for the current variant.
public getParent ( ) : Model
Результат Illuminate\Database\Eloquent\Model

getTotalVariantStock() публичный Метод

Returns the total sum of the item variants stock. This method is recursive by default, and includes variants of variants total stock.
public getTotalVariantStock ( boolean $recursive = true ) : integer | float
$recursive boolean
Результат integer | float

getVariants() публичный Метод

This method does not retrieve variants recursively.
public getVariants ( boolean $recursive = false ) : Illuminate\Database\Eloquent\Collection
$recursive boolean
Результат Illuminate\Database\Eloquent\Collection

hasVariants() публичный Метод

Returns true / false if the current item has variants.
public hasVariants ( ) : boolean
Результат boolean

isVariant() публичный Метод

Returns true / false if the current item is a variant of another item.
public isVariant ( ) : boolean
Результат boolean

makeVariantOf() публичный Метод

Makes the current item a variant of the specified item.
public makeVariantOf ( Model $item )
$item Illuminate\Database\Eloquent\Model

newVariant() публичный Метод

Returns a new Inventory model instance with it's parent ID, category ID, and metric ID set to the current item's for the creation of a variant.
public newVariant ( string $name = '' ) : Model
$name string
Результат Illuminate\Database\Eloquent\Model

parent() публичный Метод

The belongsTo parent relationship.
public parent ( ) : BelongsTo
Результат Illuminate\Database\Eloquent\Relations\BelongsTo

processMakeVariant() защищенный Метод

Processes making the current item a variant of the specified item ID.
protected processMakeVariant ( integer | string $itemId )
$itemId integer | string

variants() публичный Метод

The hasMany variants relationship.
public variants ( ) : Illuminate\Database\Eloquent\Relations\HasMany
Результат Illuminate\Database\Eloquent\Relations\HasMany

variantsRecursive() публичный Метод

The hasMany recursive variants relationship.
public variantsRecursive ( ) : Illuminate\Database\Eloquent\Relations\HasMany
Результат Illuminate\Database\Eloquent\Relations\HasMany