Add feat unsold commodity notifications

This commit is contained in:
Afiq Hamzah
2024-05-28 16:52:35 +08:00
parent 19017b8174
commit 931de4471c
9 changed files with 403 additions and 3 deletions
@@ -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');
}
}