protected function replaceFakerArray(&$stub, $fields, $timestamps, $softDeletes)
    {
        $array = [];

        foreach ($fields as $f){
            if(!empty($f['fakerFunction']) || !empty($f['fkey'])){
                $params = !empty($f['fakerFunctionParams']) ? "({$f['fakerFunctionParams']})":"";
                if(!empty($f['fkey']))
                    $array[] = "\"{$f['name']}\" => \"{$f['fkey_data']['faker']}\"";
                else
                    $array[] = "\"{$f['name']}\" => \$faker->{$f['fakerFunction']}{$params}";
            }
        }
        if($timestamps){
            $array[] = "\"created_at\" => now()";
            $array[] = "\"updated_at\" => now()";
        }
        if($softDeletes)
            $array[] = "\"deleted_at\" => NULL";

        if(count($array)) $array = trim(implode(",\n".str_repeat(' ', 8), $array), "\n");//implode(",\n", $array);
        else $array = "";

        $stub = str_replace('DummyFakerArray', $array, $stub);

        return $this;
    }
protected function replaceFakerArray(&$stub, $fields, $timestamps, $softDeletes)
    {
        $array = [];

        foreach ($fields as $f){
            if(!empty($f['fakerFunction']) || !empty($f['fkey'])){
                $params = !empty($f['fakerFunctionParams']) ? "({$f['fakerFunctionParams']})":"";
                if(!empty($f['fkey']))
                    $array[] = "\"{$f['name']}\" => \"{$f['fkey_data']['faker']}\"";
                else
                    $array[] = "\"{$f['name']}\" => \$faker->{$f['fakerFunction']}{$params}";
            }
        }
        if($timestamps){
            $array[] = "\"created_at\" => now()";
            $array[] = "\"updated_at\" => now()";
        }
        if($softDeletes)
            $array[] = "\"deleted_at\" => NULL";

        if(count($array)) $array = trim(implode(",\n".str_repeat(' ', 8), $array), "\n");//implode(",\n", $array);
        else $array = "";

        $stub = str_replace('DummyFakerArray', $array, $stub);

        return $this;
    }
protected function replaceFakerArray ( & $ stub , $ fields , $ timestamps , $ softDeletes ) { $ array = [ ] ; foreach ( $ fields as $ f ) { if ( ! empty ( $ f [ 'fakerFunction' ] ) || ! empty ( $ f [ 'fkey' ] ) ) { $ params = ! empty ( $ f [ 'fakerFunctionParams' ] ) ? "({$f['fakerFunctionParams']})" : "" ; if ( ! empty ( $ f [ 'fkey' ] ) ) $ array [ ] = "\"{$f['name']}\" => \"{$f['fkey_data']['faker']}\"" ; else $ array [ ] = "\"{$f['name']}\" => \$faker->{$f['fakerFunction']}{$params}" ; } } if ( $ timestamps ) { $ array [ ] = "\"created_at\" => now()" ; $ array [ ] = "\"updated_at\" => now()" ; } if ( $ softDeletes ) $ array [ ] = "\"deleted_at\" => NULL" ; if ( count ( $ array ) ) $ array = trim ( implode ( ",\n" . str_repeat ( ' ' , 8 ) , $ array ) , "\n" ) ; //implode(",\n", $array); else $ array = "" ; $ stub = str_replace ( 'DummyFakerArray' , $ array , $ stub ) ; return $ this ; }
Replace Faker array dummy.

@param string $stub
@param string $name

@return $this
Replace Faker array dummy .