lundi 17 décembre 2018

how to get data from model in function with laravel

is that posible to get data from model in function?

i want to get data SupplierID from model Product.

here what i try

public function productajax($id)
    {
$product = new Producttext();
      $products = $product->productexts($id);
      $hitung_products = $products->count();

      $suplierproduct = Company::select('id', 'CompanyName')
        ->where(['id' => $products->SupplierID])
        ->first();
}

but when i run it give me error

Property [SupplierID] does not exist on this collection instance.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire