json([ 'Devices' => Device::all(), 'PurchasingInformations' => PurchasingInformation::all(), 'OwnerTransactions' => OwnerTransaction::all(), 'LocationTransactions' => LocationTransaction::all() ]); }); Route::post('/import', function (Request $request) { $data = $request->json()->all(); $devices = $data['Devices']; foreach ($devices as $device) { Device::create([ 'device_id' => $device->device_id, ]); } $purchasingInformations = $data['PurchasingInformations']; $ownerTransactions = $data['OwnerTransactions']; $locationTransactions = $data['LocationTransactions']; }); Route::middleware('auth:sanctum')->get('/user', function (Request $request) { return $request->user(); });