In Laravel all model values returns as simple list. Is it possible somehow set up primary key as array key? For example for model I do it like this:
Models\Category\Filter::where('category_id', '=', $category_id)->with('values.filters.values')->get()->keyBy('id')->toArray()
But I also need that values.filters.values would use their id as key.
Try this in your model: protected $primaryKey = ' YourArrayVal ' ;
Hope it helps :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community