How to bring the object right under his id?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
19 views
There is an object
$categories store name and id you can access them in a foreach.
And how to deduce the name on the id? That is, in the PLO to make such
$categories[0] - will display the name and so on.
UP: for understanding I have id 1 and 4
You can get id to name?
$categories = DB::table('category')->get(); foreach($categories as $category){ $sub[$category->id] = $category->name; }

But then spike.
by | 19 views

1 Answer

0 like 0 dislike
Here is a direct answer to the question on stackoverflow
by

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
0 like 0 dislike
4 answers
0 like 0 dislike
1 answer
110,608 questions
257,187 answers
0 comments
40,796 users