|
Server : Apache/2.4.41 (Ubuntu) System : Linux vmi1525618.contaboserver.net 5.4.0-105-generic #119-Ubuntu SMP Mon Mar 7 18:49:24 UTC 2022 x86_64 User : www-data ( 33) PHP Version : 8.2.12 Disable Function : NONE Directory : /var/www/account.appointkrypt.com/database/seeders/ |
Upload File : |
<?php
namespace Database\Seeders;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use App\Models\Notification;
class NotificationsTableSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$notifications = [
'Create User',
'Create Appointment',
'Appointment Status Change',
'Appointment Reminder',
];
$permissions = [
'user manage',
'appointment manage',
'appointment manage',
'appointment manage',
];
foreach($notifications as $key=>$n){
$ntfy = Notification::where('action',$n)->where('type','mail')->where('module','general')->count();
if($ntfy == 0){
$new = new Notification();
$new->action = $n;
$new->status = 'on';
$new->permissions = $permissions[$key];
$new->module = 'general';
$new->type = 'mail';
$new->save();
}
}
}
}