Answer the question
In order to leave comments, you need to log in
How to add a constant field in Eloquent in a query?
The task is simple, but I can not find in the docks how to implement it.
You
need to make a selection of fields from the model, but add one more field to each record in the form of a constant, for example, "model
type" Cd" or at least how to formulate this request?
$cd = Cd::select('cds.slug', 'cds.name')->get();
Answer the question
In order to leave comments, you need to log in
Probably setAttribute and the $appends property in the model will help you to do
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question