Did you know modelsKeys()
Eloquent Collection method? It returns the primary keys from Collection of Model objects.
$users = User::active()->limit(3)->get(); $users->modelsKeys(); // [1, 2, 3]
Tip given by @iamharis010
Only until Jan 16th: coupon RESOLUTION25 for 40% off Yearly/Lifetime membership!
Read more hereDid you know modelsKeys()
Eloquent Collection method? It returns the primary keys from Collection of Model objects.
$users = User::active()->limit(3)->get(); $users->modelsKeys(); // [1, 2, 3]
Tip given by @iamharis010