app/Models/Customer.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();
        $contacts = $this->contacts;
        foreach ($contacts as $contact) {
            $array['contact_' . $contact->name] = $contact->pivot->value;
        }
        $company = $this->company->toArray();
        foreach ($company as $attributeKey => $attributeValue) {
            $company['company_' . $attributeKey] = $attributeValue;
            unset($company[$attributeKey]);
        }
        return array_merge($array, $company);
    }
public function toSearchableArray ( ) { $ array = $ this -> toArray ( ) ; $ contacts = $ this -> contacts ; foreach ( $ contacts as $ contact ) { $ array [ 'contact_' . $ contact -> name ] = $ contact -> pivot -> value ; } $ company = $ this -> company -> toArray ( ) ; foreach ( $ company as $ attributeKey => $ attributeValue ) { $ company [ 'company_' . $ attributeKey ] = $ attributeValue ; unset ( $ company [ $ attributeKey ] ) ; } return array_merge ( $ array , $ company ) ; }
Get the indexable data array for the model.
Get the indexable data array for the model .