You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
724 B
31 lines
724 B
<?php
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
use App\Ingest\DocumentHandler;
|
|
|
|
class IngestController extends Controller
|
|
{
|
|
public function store()
|
|
{
|
|
request()->validate([
|
|
'id' => 'required',
|
|
'document' => 'required|file',
|
|
]);
|
|
|
|
try {
|
|
$handler = new DocumentHandler(request()->get('id'), request()->file('document'));
|
|
|
|
$handler->handle();
|
|
|
|
return response()->json(array(
|
|
'status' => 'processing',
|
|
));
|
|
} catch (\Exception $exception) {
|
|
return response()->json([
|
|
'status' => 'error',
|
|
'message' => $exception->getMessage(),
|
|
], 400);
|
|
}
|
|
}
|
|
}
|