I'm working with a method that does an instanceof Collection check:
if ($group instanceof Collection) {
$group = $group->pluck('name');
}
This is being used in many places, so I am not able to change it (not that I want to), but I do want to pass in a collection of group names. I'm instantiating my collection like so:
$group = collect(['one', 'two', 'three']);
When I dd the $group variable it looks a duck,
Collection {#612
#items: array:3 [
0 => "one"
1 => "two"
2 => "three"
]
}
but returns false in that instanceof check. Any ideas why this might be so?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2wQ890z
via IFTTT
Aucun commentaire:
Enregistrer un commentaire