38 lines
914 B
PHP
38 lines
914 B
PHP
<?php
|
|
|
|
use App\Setting;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class UnsoldCommodityNotificationPICSeeders extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function run()
|
|
{
|
|
$data_pic = [
|
|
'pic_sunday' => [[]],
|
|
'pic_monday' => [[]],
|
|
'pic_tuesday' => [[]],
|
|
'pic_wednesday' => [[]],
|
|
'pic_thursday' => [[]],
|
|
'pic_friday' => [[]],
|
|
'pic_saturday' => [[]],
|
|
];
|
|
|
|
$transformed_data = array_map(function($pic){
|
|
return json_encode($pic);
|
|
}, $data_pic);
|
|
|
|
$outputs = array_combine(array_keys($data_pic), $transformed_data);
|
|
|
|
foreach ($outputs as $key => $data) {
|
|
Setting::where('group', 'unsold_commodity_notifications')
|
|
->where('key', $key)
|
|
->update(['value' => $data]);
|
|
}
|
|
}
|
|
}
|