src/Commands/CrudModelCommand.php
protected function createRelationshipFunction(&$stub, $relationshipName, $relationshipType, $argsString)
    {
        $tabIndent = '    ';
        $code = "public function " . $relationshipName . "()\n" . $tabIndent . "{\n" . $tabIndent . $tabIndent
            . "return \$this->" . $relationshipType . "(" . $argsString . ");"
            . "\n" . $tabIndent . "}";

        $str = '{{relationships}}';
        $stub = str_replace($str, $code . "\n" . $tabIndent . $str, $stub);

        return $this;
    }
protected function createRelationshipFunction(&$stub, $relationshipName, $relationshipType, $argsString)
    {
        $tabIndent = '    ';
        $code = "public function " . $relationshipName . "()\n" . $tabIndent . "{\n" . $tabIndent . $tabIndent
            . "return \$this->" . $relationshipType . "(" . $argsString . ");"
            . "\n" . $tabIndent . "}";

        $str = '{{relationships}}';
        $stub = str_replace($str, $code . "\n" . $tabIndent . $str, $stub);

        return $this;
    }
protected function createRelationshipFunction ( & $ stub , $ relationshipName , $ relationshipType , $ argsString ) { $ tabIndent = '    ' ; $ code = "public function " . $ relationshipName . "()\n" . $ tabIndent . "{\n" . $ tabIndent . $ tabIndent . "return \$this->" . $ relationshipType . "(" . $ argsString . ");" . "\n" . $ tabIndent . "}" ; $ str = '{{relationships}}' ; $ stub = str_replace ( $ str , $ code . "\n" . $ tabIndent . $ str , $ stub ) ; return $ this ; }
Create the code for a model relationship

@param string $stub
@param string $relationshipName  the name of the function, e.g. owners
@param string $relationshipType  the type of the relationship, hasOne, hasMany, belongsTo etc
@param array $relationshipArgs   args for the relationship function
Create the code for a model relationship