1
$carts= Cart::leftjoin('products', 'products.id', '=', 'carts.productid')
    ->leftjoin('sellers', 'sellers.id', '=', 'products.seller')
    ->select('products.*','carts.productid as productid','carts.userid as userid','carts.quantity as cartquantity','carts.subtotal as subtotal','carts.id as cartid','sellers.id as sellerid')->where('carts.userid',$_SESSION['salmonlightsuserid'])->get();
$data1 = array('carts'=>"$carts",'subtotal'=>"$subtotal",'totalquantity'=>"$totalquantity",'primaryaddress'=>"$primaryaddress");
    $useremail=$_SESSION['salmonlightsuseremail'];

     Mail::send('order-email-template',$data1, function($message) use($useremail){
     $message->to($useremail)->subject
         ('Order');
     $message->from('[email protected]');
     });

It gives error in order-email-template.blade.php Error is:- Invalid argument supplied for foreach() @foreach($carts as $cartsnew)

1 Answer 1

2

You don't need double quotes. Must be 'carts' => $carts.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.