src/classes/Console/Commands/MakeModelCommand.php
private function makeTemplate($sub_directories, $pre_model_path, $model, $no_get_id)
    {
        $file = __DIR__ . "/../templates/model/";
        $file .= $no_get_id ? "model.php.dist" : "model-with-get-id.php.dist";

        if (file_exists($file))
        {
            $template = strtr(file_get_contents($file), [
                '{{namespace}}' => get_app_namespace(),
                '{{sub_directories}}' => $sub_directories,
                '{{model}}' => $model
            ]);

            $file_path = "{$pre_model_path}/{$model}.php";

            $file = fopen($file_path, "w");
            fwrite($file, $template);
            fclose($file);

            return file_exists($file_path);
        }

        return false;
    }
private function makeTemplate($sub_directories, $pre_model_path, $model, $no_get_id)
    {
        $file = __DIR__ . "/../templates/model/";
        $file .= $no_get_id ? "model.php.dist" : "model-with-get-id.php.dist";

        if (file_exists($file))
        {
            $template = strtr(file_get_contents($file), [
                '{{namespace}}' => get_app_namespace(),
                '{{sub_directories}}' => $sub_directories,
                '{{model}}' => $model
            ]);

            $file_path = "{$pre_model_path}/{$model}.php";

            $file = fopen($file_path, "w");
            fwrite($file, $template);
            fclose($file);

            return file_exists($file_path);
        }

        return false;
    }
private function makeTemplate ( $ sub_directories , $ pre_model_path , $ model , $ no_get_id ) { $ file = __DIR__ . "/../templates/model/" ; $ file .= $ no_get_id ? "model.php.dist" : "model-with-get-id.php.dist" ; if ( file_exists ( $ file ) ) { $ template = strtr ( file_get_contents ( $ file ) , [ '{{namespace}}' => get_app_namespace ( ) , '{{sub_directories}}' => $ sub_directories , '{{model}}' => $ model ] ) ; $ file_path = "{$pre_model_path}/{$model}.php" ; $ file = fopen ( $ file_path , "w" ) ; fwrite ( $ file , $ template ) ; fclose ( $ file ) ; return file_exists ( $ file_path ) ; } return false ; }
Create the model template

@depends handle
@param  string $sub_directories
@param  string $pre_model_path
@param  string $model
@param  boolean $no_get_id
@return boolean
Create the model template