jeudi 7 janvier 2016

laravel firstOrCreate not working properly?

I am importing some data with the foursquare api. My database contains multiple foursquare_id duplicates. Am I doing something wrong with the code here?

I thought the way this is set up it will check the database for the column value of foursquare_id?

Bar::firstOrCreate([
    // do not check for these 2 below because they are mandatory
    'foursquare_id' => $item['venue']['id'],
    'name' => $item['venue']['name'],
    'postalCode' => isset($item['venue']['location']['postalCode']) ? $item['venue']['location']['postalCode'] : '',
    'city' => isset($item['venue']['location']['city']) ? $item['venue']['location']['city'] : '',
]);



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire