examples/RealWorldExample.php
protected function beforeCreate($item, array $attributes)
    {
        if ($this->wastage) {
            $item->wastage()->associate($this->wastage);
        }

        if ($this->department) {
            $item->department()->associate($this->department);
        }

        if ($this->product) {
            $item->product()->associate($this->product);
            $this->product = null;
        }
    }
protected function beforeCreate($item, array $attributes)
    {
        if ($this->wastage) {
            $item->wastage()->associate($this->wastage);
        }

        if ($this->department) {
            $item->department()->associate($this->department);
        }

        if ($this->product) {
            $item->product()->associate($this->product);
            $this->product = null;
        }
    }
{@inheritdoc}