LukePOLO\LaraCart\CartItem::__construct PHP Method

__construct() public method

CartItem constructor.
public __construct ( $id, $name, integer $qty, string $price, array $options = [], boolean $taxable = true, boolean | false $lineItem = false )
$id
$name
$qty integer
$price string
$options array
$taxable boolean
$lineItem boolean | false
    public function __construct($id, $name, $qty, $price, $options = [], $taxable = true, $lineItem = false)
    {
        $this->id = $id;
        $this->qty = $qty;
        $this->name = $name;
        $this->taxable = $taxable;
        $this->lineItem = $lineItem;
        $this->price = floatval($price);
        $this->tax = config('laracart.tax');
        $this->itemModel = config('laracart.item_model', null);
        $this->itemModelRelations = config('laracart.item_model_relations', []);
        foreach ($options as $option => $value) {
            $this->{$option} = $value;
        }
    }