2016-11-18 16:07:29 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
|
|
|
|
class ImportOptions extends Migration
|
|
|
|
{
|
|
|
|
public function up()
|
|
|
|
{
|
|
|
|
// import options
|
|
|
|
$options = config('options');
|
|
|
|
|
2018-08-16 15:15:46 +08:00
|
|
|
$options['version'] = config('app.version');
|
|
|
|
|
2016-11-18 16:07:29 +08:00
|
|
|
$options['announcement'] = str_replace(
|
|
|
|
'{version}',
|
|
|
|
$options['version'],
|
|
|
|
$options['announcement']
|
|
|
|
);
|
|
|
|
|
2018-08-16 15:15:46 +08:00
|
|
|
$options['copyright_text'] = str_replace(
|
|
|
|
'{year}',
|
|
|
|
Carbon\Carbon::now()->year,
|
|
|
|
$options['copyright_text']
|
|
|
|
);
|
|
|
|
|
2016-11-18 16:07:29 +08:00
|
|
|
foreach ($options as $key => $value) {
|
|
|
|
Option::set($key, $value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public function down()
|
|
|
|
{
|
|
|
|
DB::table('options')->delete();
|
|
|
|
}
|
|
|
|
}
|