refactored migrations
This commit is contained in:
@ -1,64 +0,0 @@
|
||||
<?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('offline-payments.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()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
@ -1,47 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\OfflinePayments\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Setting;
|
||||
|
||||
class OfflinePaymentsDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
Model::unguard();
|
||||
|
||||
$this->create();
|
||||
|
||||
Model::reguard();
|
||||
}
|
||||
|
||||
private function create()
|
||||
{
|
||||
$methods = array();
|
||||
|
||||
$methods[] = array(
|
||||
'code' => 'offline-payments.cash.1',
|
||||
'name' => 'Cash',
|
||||
'customer' => '0',
|
||||
'order' => '1',
|
||||
'description' => null,
|
||||
);
|
||||
|
||||
$methods[] = array(
|
||||
'code' => 'offline-payments.bank_transfer.2',
|
||||
'name' => 'Bank Transfer',
|
||||
'customer' => '0',
|
||||
'order' => '2',
|
||||
'description' => null,
|
||||
);
|
||||
|
||||
Setting::set('offline-payments.methods', json_encode($methods));
|
||||
}
|
||||
}
|
@ -16,7 +16,6 @@ class Main extends Provider
|
||||
public function boot()
|
||||
{
|
||||
$this->loadTranslations();
|
||||
$this->loadMigrations();
|
||||
$this->loadViews();
|
||||
$this->loadEvents();
|
||||
}
|
||||
@ -51,16 +50,6 @@ class Main extends Provider
|
||||
$this->loadTranslationsFrom(__DIR__ .'/../Resources/lang', 'offline-payments');
|
||||
}
|
||||
|
||||
/**
|
||||
* Load migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function loadMigrations()
|
||||
{
|
||||
$this->loadMigrationsFrom(__DIR__ . '/../Database/Migrations');
|
||||
}
|
||||
|
||||
/**
|
||||
* Load events.
|
||||
*
|
||||
|
Reference in New Issue
Block a user