jeudi 14 janvier 2021

preg_match() expects parameter 2 to be string, object given

i got this error when i'm trying to send multiple email, and i also want to pass a data to mail view.

here is my controller:

$get_no_inven = Permohonan::find($id_per)->no_inventaris;
    $get_users = DB::table('users')->where('hak_akses','=','deputi')->get(['email']);
    
    $recipients = [ $get_users ];

    $subject = 'Testing email no 2';
    $meta = 'meta';

    foreach($recipients as $recipient) {
        // here you declare variables accesable in view file
        $dataToPassToEmailView = [];
        // **key** of this table is variable **name in view**
        $dataToPassToEmailView['no_inventaris'] = $get_no_inven;

        Mail::send('mailkedua', $dataToPassToEmailView, function($message) use ($subject, $recipient, $meta) {
            $message->to($recipient, 'Deputi Manager')->subject($subject);
            $message->from('app.staging@nutrifood.co.id','Kalibrasi Online');
        });
    }

and here is my mail view:

<p>Dear Deputi Manager,</p>

<p>Berikut kami informasikan terdapat hasil kalibrasi terbaru alat dengan nomor inventaris 
Mohon bantuannya untuk melakukan approval, silahkan akses "Link CALON" <a href="http://baf-staging-x2:3030/lihat_permohonan_deputi/">http://baf-staging-x2:3030/lihat_permohonan_deputi/</a></p>


<p>Terima kasih,</p>
<p>CALON</p>

i don't understand where i'm doing wrong so please help me, thankyou!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire