See how to make the CLI communicate with the browser (your app).
In this case, we'll create a user in your app via the CLI by sending them to the browser. When the user registers, a valid API token is retrieved back by the CLI, allowing it to make future API calls against the applications (fictional) API.
app/Console/Commands/RegisterCommand.php
- the command that lets users register. In reality this would likely be a separate project (a cli app that users install locally, which can communicate to your app's API)routes/api.php
- Defines a Resource controllerApp\Http\Controllers\CliSessionController
app/Http/Controllers/CliSessionController.php
- the controller allow CLI users to create/check on a CLI sessionapp/Http/Controllers/Auth/RegisteredUserController.php
- Laravel Breeze register controller, which tweaks for CLI session registrationresources/views/auth/register.blade.php
- companion tweaks for Breeze's registration
app/Models/CliSession.php
- theCLISession
model, which is simpledatabase/migrations
- a migration to create thecli_sessions
table