<?php

use Illuminate\Database\Seeder;

class UsersNotificationSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        foreach (\App\ConsultingRequest::cursor() as $consulting) {
            $notificationType = '';
            if ($consulting->consulting_way == 'phone'){
                $notificationType = 'tel_consultation';
            }
            if ($consulting->consulting_way == 'zoom'){
                $notificationType = 'zoom_consultation';
            }
            if ($consulting->consulting_way == 'office'){
                $notificationType = 'office_consultation';
            }
            factory(\App\UsersNotification::class)->create([
                'user_id' => $consulting->user_id,
                'service_id' => $consulting->id,
                'notification_type' => $notificationType,
            ]);
        }
        foreach (\App\DocumentationRequest::cursor() as $document) {
            $notificationType = '';
            if ($document->type == 'inside_office'){
                $notificationType = 'inside_doc_request';
            }
            if ($document->type == 'outside_office'){
                $notificationType = 'outside_doc_request';
            }
            factory(\App\UsersNotification::class)->create([
                'user_id' => $consulting->user_id,
                'service_id' => $consulting->id,
                'notification_type' => $notificationType,
            ]);
        }
    }

}
