Support the ongoing development of →
Configuration Input Database
Last updated 2 years ago.

How can you be sure that book is found?

The find method will return null if it's not found. Why don't you try the findOrFail method? You can confirm if the object is found by putting


after the find.


When I dd($content); I get the two books that i added to my cart, but I cannot get them to show up in my cart.blade.php. maybe my cart.blade.php is wrong?

this is the dd($content); output

CartCollection {#170 ▼
  #items: array:2 [▼
    "027c91341fd5cf4d2579b49c4b6a90da" => CartRowCollection {#171 ▼
      #associatedModel: null
      #associatedModelNamespace: null
      #items: array:7 [▼
        "rowid" => "027c91341fd5cf4d2579b49c4b6a90da"
        "id" => 1
        "name" => "PHP is fun"
        "qty" => 9
        "price" => 3.51
        "options" => CartRowOptionsCollection {#172 ▶}
        "subtotal" => 31.59
    "370d08585360f5c568b18d1f2e4ca1df" => CartRowCollection {#173 ▼
      #associatedModel: null
      #associatedModelNamespace: null
      #items: array:7 [▼
        "rowid" => "370d08585360f5c568b18d1f2e4ca1df"
        "id" => 2
        "name" => "Welcome to Cisco"
        "qty" => 75
        "price" => 354.59
        "options" => CartRowOptionsCollection {#174 ▶}
        "subtotal" => 26594.25

This is my cart.blade.php code

<!DOCTYPE html>
    <title>Cart Page</title>
                <th>Item Price</th>



                <td><?php echo $items->id;?></td>
                <td><p><strong><?php echo $items->name;?></strong></p></td>
                <td><input type="text" value="<?php echo $items->qty;?>"></td>
                <td>$<?php echo $items->price;?></td>





$cart isn't been given a value if you use compact('content').


you also need to loop through the items?

you havent given us the controller code for displaying cart? in the controller you could probably try to do dd($rowsfromdb) to check...

also check if CART table (I assume?) is populated..


Sign in to participate in this thread!


Your banner here too?


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.