public function handle(LoanWasCreated $event) { $docs = Requireddocument::where('loantype_id', $event->loan->loan_type_id)->get(); foreach ($docs as $doc) { Attachment::create(['loan_id' => $event->loan->id, 'title' => $doc->document]); } }