create CreateDatabase.php

This commit is contained in:
MsFoued 2016-11-20 16:36:20 +01:00 committed by GitHub
parent 56556bf05e
commit 65e5dd631f
1 changed files with 34 additions and 0 deletions

View File

@ -0,0 +1,34 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use DB;
class CreateDatabase extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'make:database {db_name}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Create a new database';
/**
* Execute the console command.
*
* @return mixed
*/
public function handle()
{
DB::statement('CREATE DATABASE IF NOT EXISTS '.$this->argument('db_name').";");
}
}