2017_09_19_delete_offline_file.php
1.69 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
class OfflineFile extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$module = Module::get('Offline');
if (!empty($module) && version_compare($module->get('version'), '1.0.0') == 0) {
$offline_payments = json_decode(setting('offline.payment.methods'), true);
if (!empty($offline_payments)) {
$offlinepayment = array();
foreach ($offline_payments as $offline_payment) {
$code = explode('.', $offline_payment['code']);
$offline_payment['code'] = $code[1];
$offlinepayment[] = array(
'code' => 'offlinepayment.' . $code[1] . '.' . $code[2],
'name' => $offline_payment['name'],
'customer' => 0,
'order' => $offline_payment['order'],
'description' => $offline_payment['description']
);
}
//$company_id = $this->command->argument('company');
// Set the active company settings
setting()->setExtraColumns(['company_id' => 1]);
setting()->set('offlinepayment.methods', json_encode($offlinepayment));
setting()->forget('offline.payment.methods');
setting()->save();
}
$module->delete();
Artisan::call('cache:clear');
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
}
}