laravel

public function postShowCage ()
    {
        
        $loginuser = User::find(1);
        // dd($loginuser->name); // "EC-Boy"


        /**
         * 失敗例
         */
        // dd(Cart::find(2));
        /**
         * 成功例
         */
        // dd(Cart::find(2)->products);

        // SQLSTATE[42S22]: Column not found: 1054 
        // Unknown column 'products.cart_id' in 'where clause' 
        // (SQL: select * from `products` 
        //  where `products`.`cart_id` = 2 and `products`.`cart_id` is not null)

        // SQLSTATE[42S22]: Column not found: 1054 
        // Unknown column 'products.foreign_key' in 'where clause' 
        // (SQL: select * from `products` 
        // where `products`.`foreign_key` is null and `products`.`foreign_key` is not null)

        /**
         * [成功例]
         * return $this->hasMany('App\Product', 'id');
         */
        // Collection {#203 ▼
        //     #items: array:1 [▼
        //          0 => Product {#218 ▼
        //          #connection: "mysql"
        //          #table: null
        //          #primaryKey: "id"
        //          #keyType: "int"
        //          +incrementing: true
        //          #with: []
        //          #withCount: []
        //          #perPage: 15
        //          +exists: true
        //          +wasRecentlyCreated: false
        //          #attributes: array:9 [▼
        //            "id" => 2
        //            "abbreviation" => "Orastruct"
        //            "name" => "Orastruct 80/20 TCP/HA Synthetic Graft Material"
        //            "image" => "B005_006.jpg"
        //             "manufacturer" => "Salvin社"
        //             "description" => """
        //             β-TCP 80%, ハイドロキシアパタイト
        //             """
        //            "category_id" => 1
        //            "created_at" => "2020-03-04 10:27:00"
        //            "updated_at" => "2020-03-04 10:27:00"
        //          ]
        //          #original: array:9 [▶]
        //          #changes: []
        //          #casts: []
        //          #dates: []
        //          #dateFormat: null
        //          #appends: []
        //          #dispatchesEvents: []
        //          #observables: []
        //          #relations: []
        //          #touches: []
        //          +timestamps: true
        //          #hidden: []
        //          #visible: []
        //          #fillable: []
        //          #guarded: array:1 [▶]
        //          }
        //      ]
        //   }