Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what happend to getRelatedIds in Laravel 5.4

Tags:

laravel

I was using this function in 5.3 and now when I try to use it in 5.4 like this:

$post->tags()->getRelatedIds(); 

I am getting errors that function does not exist, I checked the documentation for 5.4 and it's not there anymore.

Anyone knows why this usefull function was removed and what I can do to get all ids from related model?

like image 319
niko craft Avatar asked Mar 08 '17 21:03

niko craft


1 Answers

In Laravel 5.4 and 5.5 the getRelatedIds is replaced by allRelatedIds.

$post->tags()->allRelatedIds(); 
like image 114
Geordy James Avatar answered Sep 28 '22 16:09

Geordy James