Table data is not refreshed after clicking custom table action

For some reason it takes a reload to get the live data from the table after I perform a custom action. Attached is my custom action code
Tables\Actions\Action::make('Check')
->icon('heroicon-o-check-circle')
->action(function(BocomVoucher $record){
$url = "http://MYAPI:3606/validate";
$data = array(
"vouchers" => [
$record->voucher
]
)
$json_data = json_encode($data)
$ch = curl_init($url);
if(curl_errno($ch)) {
dd('cURL error: ' . curl_error($ch));
} else {
$response = json_decode($response);
$responseData = $response[0];
if(str_contains($responseData->message, 'expired')){
$record->status = 3;
}
else if(str_contains($responseData->message, 'entering')){
$record->status = 2;
}
curl_close($ch);
})
Tables\Actions\Action::make('Check')
->icon('heroicon-o-check-circle')
->action(function(BocomVoucher $record){
$url = "http://MYAPI:3606/validate";
$data = array(
"vouchers" => [
$record->voucher
]
)
$json_data = json_encode($data)
$ch = curl_init($url);
if(curl_errno($ch)) {
dd('cURL error: ' . curl_error($ch));
} else {
$response = json_decode($response);
$responseData = $response[0];
if(str_contains($responseData->message, 'expired')){
$record->status = 3;
}
else if(str_contains($responseData->message, 'entering')){
$record->status = 2;
}
curl_close($ch);
})
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?