Difference between two apparently similar queries.

Posted 11 months ago by francoboy7

Hi everyone,

could someone tell me the difference between these 2 queries ? The first one did not work and the second one works flawlessly...

***Note : ***$lodging->favorites() reference a hasMany relation.

$lodging->favorites()->where('user_id', auth()->id())->get()->first()->delete();

$lodging->favorites()->get()->where('user_id', auth()->id())->first()->delete();

Thanks

Please sign in or create an account to participate in this conversation.