Models Command
public function create($modelName) {
// Define the path for the new model
$modelName = ucfirst($modelName);
$modelPath = ROOT_PATH . '/application/Models/' . ucfirst($modelName) . 'Model.php';
// Check if the model already exists
if (file_exists($modelPath)) {
echo "Model {$modelName} already exists.\n";
return;
}
// Define the contents of the model
$modelContent = // Model File Structure
// Create the model file
file_put_contents($modelPath, $modelContent);
echo "Model {$modelName}Model has been created successfully.\n";
}Last updated
Was this helpful?