在Laravel中将数据库克隆到不同的名称

Hi I am new to Laravel.

In our project ,we have to clone the current database into same server with different name.For example if our current database name is "test" means , I have to clone the database(test) into same server with different name like "test_2018" and I need all the tables in database(test) to our clone database(test_2018).

How can I achieve this in Laravel programmatically and I have used laravel version 5.0.

You can use the mysql command to dump and clone a database:

mysqldump db_name | mysql new_db_name

You can make an Artisan command for this and call the command on a button click or something like that,

For example:

public function handle()
{
    $database = $this->argument('database_name');
    $password = $this->argument('password');
    $command = sprintf('mysqldump <original_db> -u forge -p\'%s\' | mysql new %s', $password, $database);
    exec($command);
}

Read the docs to find information on creating Artisan commands.