Telescope does not log API calls inside a command class by default. However, it is possible to manually log these calls using Telescope's telescope() helper function. Here's an example of how to do this:
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
use Laravel\Telescope\Telescope;
class MyCommand extends Command
{
protected $signature = 'my:command';
public function handle()
{
// Make the API call
$response = Http::post('https://jsonplaceholder.typicode.com/posts', ['title' => 'test']);
// Log the API call using Telescope
Telescope::recordRequest($response->url(), $response->method(), $response->status(), $response->json(), [
'command' => 'my:command',
]);
}
}
In this example, we're using Telescope's recordRequest() method to manually log the API call. We're passing in the URL, HTTP method, status code, response body, and some additional metadata (in this case, the name of the command that made the API call).
Note that you'll need to make sure that Telescope is properly configured and enabled in your application for this to work.