Blame view
api/app/Http/Controllers/V1/Partners/VdmController.php
828 Bytes
b28322f5b Added VDM endpoint |
1 2 3 4 5 6 7 8 9 |
<?php namespace App\Http\Controllers\V1\Partners; use App\Http\Controllers\Controller; use App\Http\Requests\VdmRequest; use Carbon\Carbon; use Illuminate\Support\Facades\DB; |
b28322f5b Added VDM endpoint |
10 11 12 13 14 |
class VdmController extends Controller { public function store(VdmRequest $request) { |
92d105af1 Added VDM persist... |
15 |
$records = []; |
b28322f5b Added VDM endpoint |
16 |
|
92d105af1 Added VDM persist... |
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
// merge two input arrays $cve = $request->get('cve'); $cwe = $request->get('cwe'); $merged = array_merge($cve, $cwe); foreach ($merged as $item) { $records[] = [ 'asset_id' => $request->get('asset_id'), 'time' => Carbon::createFromTimestamp($request->get('timestamp')), 'value' => $item ]; } DB::table('vdm')->insert($records); |
b28322f5b Added VDM endpoint |
31 32 33 |
return response()->json(['success' => 'success'], 200); } } |