そのため、Laravel のモデル ファクトリを使用してデフォルトのフェイカーではなく、外部 API から自分の dB にデータをシードしようとしていますが、行き詰まっています。以下は私のコードです:
$factory->define(\App\Models\State::class, function(){
    $client = new Client();
    $stateQuery = $client->get('http://states-and-cities.com/api/v1/states');
    $states = $stateQuery->getBody();
    $states = json_decode($states, true);
    foreach ($states as $state) {
        return [
            'name' => $state['name'],
        ];
    }
});
何が起こっているのかというと、期待どおりのリターンが 1 つのレコードのみをシードしているということですが、レコード全体をシードする必要があります。どうすればこれを修正できますか?