i need to pluck fromcity relation from Route. eg
$list = Route::with('fromcity')->get()->pluck('fromcity')->toArray();
but it returns duplicate cities from relation. how to get distinct records? Thanks in Advance
Try this
$list = Route::with('fromcity')->get()->pluck('fromcity')->unique()->toArray();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With