To define an accessor, create a getFooAttribute method on your model where Foo is the "studly" cased name of the column you wish to access. In this example, we'll define an accessor for the first_name attribute. The accessor will automatically be called by Eloquent when attempting to retrieve the value of the first_name attribute:
By:Xtreem Solution
Thanks and yes you are right but i dont want to retrieve the attribute, i just want to fetch the collection and then send it back to api response in json formate.
when snak_attribute is true then it work perfectly.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community