Implement seeders instead of seeding using migrations, log whatasapp message

This commit is contained in:
Afiq Hamzah
2024-06-05 16:04:39 +08:00
parent cbf6bd5f1f
commit ab6ee95d64
5 changed files with 114 additions and 32 deletions
@@ -0,0 +1,89 @@
<?php
use App\Setting;
use Illuminate\Database\Seeder;
class UnsoldCommodityNotificationSettingSeeders extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$data = [
[
'key' => 'status',
'value' => '1',
'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);
});
}
}