protected function replaceGuarded(&$stub, $fields){

        $guarded = [];
        foreach ($fields as $f){
            if($f['add_to']=='guarded') $guarded[] = "\"{$f['name']}\"";
        }
        if(count($guarded)) $guarded = "protected \$guarded = [".implode(',',$guarded)."];";
        else $guarded = "";

        $stub = str_replace('DummyGuarded', $guarded, $stub);

        return $this;
    }
protected function replaceGuarded(&$stub, $fields){

        $guarded = [];
        foreach ($fields as $f){
            if($f['add_to']=='guarded') $guarded[] = "\"{$f['name']}\"";
        }
        if(count($guarded)) $guarded = "protected \$guarded = [".implode(',',$guarded)."];";
        else $guarded = "";

        $stub = str_replace('DummyGuarded', $guarded, $stub);

        return $this;
    }
protected function replaceGuarded ( & $ stub , $ fields ) { $ guarded = [ ] ; foreach ( $ fields as $ f ) { if ( $ f [ 'add_to' ] == 'guarded' ) $ guarded [ ] = "\"{$f['name']}\"" ; } if ( count ( $ guarded ) ) $ guarded = "protected \$guarded = [" . implode ( ',' , $ guarded ) . "];" ; else $ guarded = "" ; $ stub = str_replace ( 'DummyGuarded' , $ guarded , $ stub ) ; return $ this ; }
Replace guarded dummy.

@param string $stub
@param array  $fields

@return $this
Replace guarded dummy .