src/FabricateContext.php
public function association($association, $recordCount = 1, $callback = null)
    {
        if (!is_array($association)) {
            $association = [$association, 'association' => $association];
        }
        $attributes = Fabricate::association($association[0], $recordCount, $callback);
        if ($this->model) {
            $associations = $this->model->getAssociated();
            if (isset($associations[$association['association']])
            && $associations[$association['association']] !== 'hasMany'
            && !empty($attributes)) {
                $attributes = $attributes[0];
            }
        }
        return $attributes;
    }
public function association($association, $recordCount = 1, $callback = null)
    {
        if (!is_array($association)) {
            $association = [$association, 'association' => $association];
        }
        $attributes = Fabricate::association($association[0], $recordCount, $callback);
        if ($this->model) {
            $associations = $this->model->getAssociated();
            if (isset($associations[$association['association']])
            && $associations[$association['association']] !== 'hasMany'
            && !empty($attributes)) {
                $attributes = $attributes[0];
            }
        }
        return $attributes;
    }
public function association ( $ association , $ recordCount = 1 , $ callback = null ) { if ( ! is_array ( $ association ) ) { $ association = [ $ association , 'association' => $ association ] ; } $ attributes = Fabricate :: association ( $ association [ 0 ] , $ recordCount , $ callback ) ; if ( $ this -> model ) { $ associations = $ this -> model -> getAssociated ( ) ; if ( isset ( $ associations [ $ association [ 'association' ] ] ) && $ associations [ $ association [ 'association' ] ] !== 'hasMany' && ! empty ( $ attributes ) ) { $ attributes = $ attributes [ 0 ] ; } } return $ attributes ; }
Only create model attributes array for association.

@param mixed $association association name
@param int $recordCount count for creating.
@param mixed $callback callback or array can change fablicated data if you want to overwrite
@return array model attributes array.
Only create model attributes array for association .