blessing-skin-server/database/migrations/2016_11_18_134542_import_options.php
2019-03-23 15:44:16 +08:00

46 lines
890 B
PHP

<?php
use Illuminate\Database\Migrations\Migration;
class ImportOptions extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
// import options
$options = config('options');
$options['version'] = config('app.version');
$options['announcement'] = str_replace(
'{version}',
$options['version'],
$options['announcement']
);
$options['copyright_text'] = str_replace(
'{year}',
Carbon\Carbon::now()->year,
$options['copyright_text']
);
foreach ($options as $key => $value) {
Option::set($key, $value);
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
DB::table('options')->delete();
}
}