Add feat unsold commodity notifications
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateSettingsTable extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::create('settings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('key')->unique();
|
||||
$table->text('value')->nullable();
|
||||
$table->string('group')->nullable();
|
||||
$table->text('description')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('settings');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
<?php
|
||||
|
||||
use App\Setting;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class AddUnsoldCommoditiesSettings extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
$data = [
|
||||
[
|
||||
'key' => 'status',
|
||||
'value' => 'true',
|
||||
'group' => 'unsold_commodity_notifications',
|
||||
'description' => 'Turn on or turn off notification for unsold commodity notifications',
|
||||
],
|
||||
[
|
||||
'key' => 'start_time',
|
||||
'value' => '20:00',
|
||||
'group' => 'unsold_commodity_notifications',
|
||||
'description' => 'The time the notifications start',
|
||||
],
|
||||
[
|
||||
'key' => 'end_time',
|
||||
'value' => '23:00',
|
||||
'group' => 'unsold_commodity_notifications',
|
||||
'description' => 'The time the notifications end',
|
||||
],
|
||||
[
|
||||
'key' => 'message',
|
||||
'value' => 'Baki komoditi masih lagi berbaki dan belum habis dijual',
|
||||
'group' => 'unsold_commodity_notifications',
|
||||
'description' => 'Turn on or turn off notification for unsold commodity notifications',
|
||||
],
|
||||
[
|
||||
'key' => 'pic_sunday',
|
||||
'value' => '',
|
||||
'group' => 'unsold_commodity_notifications',
|
||||
'description' => 'Person Incharge on Sunday',
|
||||
],
|
||||
[
|
||||
'key' => 'pic_monday',
|
||||
'value' => '',
|
||||
'group' => 'unsold_commodity_notifications',
|
||||
'description' => 'Person Incharge on Monday',
|
||||
],
|
||||
[
|
||||
'key' => 'pic_tuesday',
|
||||
'value' => '',
|
||||
'group' => 'unsold_commodity_notifications',
|
||||
'description' => 'Person Incharge on Tuesday',
|
||||
],
|
||||
[
|
||||
'key' => 'pic_wednesday',
|
||||
'value' => '',
|
||||
'group' => 'unsold_commodity_notifications',
|
||||
'description' => 'Person Incharge on Wednesday',
|
||||
],
|
||||
[
|
||||
'key' => 'pic_thursday',
|
||||
'value' => '',
|
||||
'group' => 'unsold_commodity_notifications',
|
||||
'description' => 'Person Incharge on Thursday',
|
||||
],
|
||||
[
|
||||
'key' => 'pic_friday',
|
||||
'value' => '',
|
||||
'group' => 'unsold_commodity_notifications',
|
||||
'description' => 'Person Incharge on Friday',
|
||||
],
|
||||
[
|
||||
'key' => 'pic_saturday',
|
||||
'value' => '',
|
||||
'group' => 'unsold_commodity_notifications',
|
||||
'description' => 'Person Incharge on Saturday',
|
||||
],
|
||||
|
||||
];
|
||||
|
||||
array_walk($data, function($setting){
|
||||
Setting::create($setting);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('settings');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user