📜  如何将数据从 api 保存到 laravel - PHP 代码示例

📅  最后修改于: 2022-03-11 14:54:41.544000             🧑  作者: Mango

代码示例1
$res = $gallery->request('GET','https://www.instagram.com/explore/tags/MIZONEDanceBattle/?__a=1');
    $data = json_decode($res->getBody()->getContents(), true);

    $gallery = Gallery::firtsOrCreate([
            'shortcode',
            'thumbnail_src',
        ], $data]); // add $data here
    $gallery->save();