Shaza
An external endpoint
No only for one user, but the endpoint exits the timeout, and when I increased the request time and monitored the response, it responds to all inactive users and activates them,
noting that the activation endpoints perform the process normally and were tested from the postman.
8 replies
An external endpoint
CheckboxColumn::make('active')
->updateStateUsing(function (User $record, bool $state): bool {
$payload = [
'user' => "user/{$record->id}",
'active' =>0,
]; Log::info('Sending payload to API:', $payload); try { $response = Http::post('127.0.0.1:8007/api/activateuser', $payload); if ($response->successful()) { Log::info('API response:', ['status' => $response->status(), 'body' => $response->body()]); $record->forceFill(['active' => $state])->save(); Notification::make() ->title('Status updated successfully') ->success() ->send(); return $state; } Log::error('API request failed:', ['status' => $response->status(), 'body' => $response->body()]); return $record->active; } catch (\Exception $e) { Log::error('API request exception:', ['error' => $e->getMessage()]); return $record->active; } }), The problem is that it requests the endpoint repeatedly for all users, meaning that it activates all users despite passing one user.
'active' =>0,
]; Log::info('Sending payload to API:', $payload); try { $response = Http::post('127.0.0.1:8007/api/activateuser', $payload); if ($response->successful()) { Log::info('API response:', ['status' => $response->status(), 'body' => $response->body()]); $record->forceFill(['active' => $state])->save(); Notification::make() ->title('Status updated successfully') ->success() ->send(); return $state; } Log::error('API request failed:', ['status' => $response->status(), 'body' => $response->body()]); return $record->active; } catch (\Exception $e) { Log::error('API request exception:', ['error' => $e->getMessage()]); return $record->active; } }), The problem is that it requests the endpoint repeatedly for all users, meaning that it activates all users despite passing one user.
8 replies