-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathClientCheckinController.php
More file actions
27 lines (23 loc) · 956 Bytes
/
ClientCheckinController.php
File metadata and controls
27 lines (23 loc) · 956 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
<?php
namespace App\Http\Controllers\Common;
use Throwable;
use InvalidArgumentException;
use App\Http\Controllers\Controller;
use App\Services\Client\ClientCheckinService;
use App\Http\Requests\Client\ClientRequestCheckin;
class ClientCheckinController extends Controller
{
public function slaveCheckin(ClientRequestCheckin $request)
{
try {
$slave = ClientCheckinService::checkin($request->validated());
return $this->messageResponse(true, "Slave Checkin Successful", 200, $slave);
} catch (InvalidArgumentException $e) {
return $this->errorMessageResponse(false, 'Invalid Input', $e->getMessage(), 422);
} catch (Throwable $e) {
return $this->errorMessageResponse(false, "Slave checkin failed", $e->getMessage(), 500);
} catch (\Exception $e) {
return $this->errorMessageResponse(false, 'Unexpected error', $e->getMessage(), 500);
}
}
}