app/Models/Order.php
/**
     * Get the indexable data array for the model.
     *
     * @return array
     */
Get the indexable data array for the model.
@return array
Get the indexable data array for the model . @return array
public function toSearchableArray()
    {
        $array = $this->toArray();
        $array['invoice_number'] = $this->invoice_number;
        $company = $this->company->toArray();
        foreach ($company as $attributeKey => $attributeValue) {
            $company['company_' . $attributeKey] = $attributeValue;
            unset($company[$attributeKey]);
        }
        $products = [];
        foreach ($this->items as $product) {
            $products[] = $product->toArray();
        }
        return array_merge($array, $company, ['items' => $products]);
    }
public function toSearchableArray ( ) { $ array = $ this -> toArray ( ) ; $ array [ 'invoice_number' ] = $ this -> invoice_number ; $ company = $ this -> company -> toArray ( ) ; foreach ( $ company as $ attributeKey => $ attributeValue ) { $ company [ 'company_' . $ attributeKey ] = $ attributeValue ; unset ( $ company [ $ attributeKey ] ) ; } $ products = [ ] ; foreach ( $ this -> items as $ product ) { $ products [ ] = $ product -> toArray ( ) ; } return array_merge ( $ array , $ company , [ 'items' => $ products ] ) ; }
Get the indexable data array for the model.
Get the indexable data array for the model .