那就对了.如果传递的数组的所有元素都存在于行对象中,则只会收到"first" .
另一种方法是使用firstOrNew:
$foo = Bar::firstOrNew(['foursquare_id' => $item['venue']['id']]); // find the object with this foursquare_id. Nothing found? Create a new one with the given foursquare_id $foo->name = $item['venue']['name']; $foo->postalCode = isset($item['venue']['location']['postalCode']) ? $item['venue']['location']['postalCode'] : ''; $foo->city = isset($item['venue']['location']['city']) ? $item['venue']['location']['city'] : ''; $foo->save();