#database #development #eloquent #laravel #php
Did you know that in Laravel there was a method called
getRelatedIds on the belongs to many relationship?
It was renamed to
allRelatedIds and it can be used as an alternative to
pluck('id') to get all of the IDs for the
1// instead of 2$article->tags()->pluck('id')->toArray(); 3 4// you can use 5$article->tags()->allRelatedIds()->toArray();
If this post was enjoyable or useful for you, please share it! If you have comments, questions, or feedback, you can email my personal email. To get new posts, subscribe use the RSS feed.