lundi 18 mai 2020

Laravel collection variable null return

I have a DB table name is the product. when I query (eloquent) to that table return collection object with all the fields. but I access the banner_image field every time return a null value. but I can access the other variables in that collection working fine. If I Defining An Accessor, the issue is solved. I want to know about, whats the issue only for one variable.

DD to eloquent collection

#original: array:20 [▼
    "id" => 2
    "type_id" => 2
    "banking_id" => 1
    "page" => "savings-accounts"
    "url_slug" => "repellat-corporis-id-distinctio"
    "title" => "{"en":"Mertz Underpass","si":"","ta":""}"
    "short_description" => "{"en":"Ut laboriosam expedita qui repellat labore ut qui suscipit blanditiis fuga fugit et rerum.","si":"","ta":""}"
    "interest_rate" => 40.9
    "first_link_text" => null
    "second_link_text" => null
    "image" => "https://dummyimage.com/716x500"
    "banner_image" => "https://dummyimage.com/716x500"
    "banner_description" => "{"en":"Est placeat et aut laborum consequatur ab quas esse totam voluptatem et atque adipisci est quaerat aut et.","si":"","ta":""}"
    "landing_page" => 0
    "side_block" => null
    "calculator" => null
    "sort" => 0
    "created_at" => null
    "updated_at" => null
    "deleted_at" => null
  ]

when I access the $innerProduct->banner_image (in controller) every time return null value.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire