src/classes/Console/Commands/MakeRuleCommand.php
private function ruleTemplate($rule)
    {
        $file = __DIR__ . "/../templates/validator/rule.php.dist";

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

            if (!file_exists(app_path("Validation/Rules")))
            {
                mkdir(app_path("Validation/Rules"), 0755, true);
            }

            $file_path = app_path("Validation/Rules/{$rule}.php");

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

            return file_exists($file_path);
        }

        return false;
    }
private function ruleTemplate($rule)
    {
        $file = __DIR__ . "/../templates/validator/rule.php.dist";

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

            if (!file_exists(app_path("Validation/Rules")))
            {
                mkdir(app_path("Validation/Rules"), 0755, true);
            }

            $file_path = app_path("Validation/Rules/{$rule}.php");

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

            return file_exists($file_path);
        }

        return false;
    }
private function ruleTemplate ( $ rule ) { $ file = __DIR__ . "/../templates/validator/rule.php.dist" ; if ( file_exists ( $ file ) ) { $ template = strtr ( file_get_contents ( $ file ) , [ '{{namespace}}' => get_app_namespace ( ) , '{{rule}}' => $ rule ] ) ; if ( ! file_exists ( app_path ( "Validation/Rules" ) ) ) { mkdir ( app_path ( "Validation/Rules" ) , 0755 , true ) ; } $ file_path = app_path ( "Validation/Rules/{$rule}.php" ) ; $ file = fopen ( $ file_path , "w" ) ; fwrite ( $ file , $ template ) ; fclose ( $ file ) ; return file_exists ( $ file_path ) ; } return false ; }
Create the rule template.

@param  string $rule
@return boolean
Create the rule template .