Artisan Commands
None of them auto-discover anything: the component table and the action table are still the two you edit by hand. The commands only make sure you write them correctly. Every make: command accepts --dry-run to show what it would write.
Overview
| Command | What it does |
|---|---|
make:linker | Creates a Linker component + writes its alias into LinkerServiceProvider |
make:linker-action | Writes the PHP argument spec and an actions.js stub together |
linker:list | Lists components, modes and both action tables; checks PHP ↔ JS match one-to-one |
make:component | Creates a CG Component (class + view) and registers it in the Catalog |
make:linker
php artisan make:linker Order --dry-runphp artisan make:linker Order --alias=orders| Argument / option | Notes |
|---|---|
name | Order or OrderLinker |
--alias= | The alias used by the browser; defaults to the camelCase name |
--force | Overwrite existing files |
--dry-run | Only print what it would do |
Creates app/Http/LinkerComponents/OrderLinker.php and inserts a line above the marker in registerComponents():
LinkerRegistry::registerMany([
'customer' => CustomerLinker::class,
'orders' => OrderLinker::class,
// make:linker ← new lines go above this
]);If the marker has been deleted, the command doesn't guess. It prints the line for you to paste. When a file has been edited, one manual step beats writing to the wrong place.
make:linker-action
php artisan make:linker-action ui.spinner target:string on:bool?| Argument | Notes |
|---|---|
name | namespace.action form |
args* | key:type; types string int number bool array mixed, with ? for optional |
--dry-run | Only print what it would do |
Details and design rules in Governing Actions.
linker:list
php artisan linker:listphp artisan linker:list --methodsphp artisan linker:list --health| Option | Notes |
|---|---|
| (none) | Components, modes, actions; checks PHP ↔ JS one-to-one. Creates no components, touches no cache or network |
--methods | Each component's #[Computable] methods, their arguments, and merged access rules (@auth / @verified / @ability) |
--health | Lifetimes, Stateless routes, local cache reads/writes/locks; isolated keys, cleaned up afterwards, no flush |
--allow-network-cache | Lets --health connect to network stores such as Redis |
--health-user=42 | Verifies Stateless signature generation with an existing user id (creates no user, prints no URL) |
linker:list doesn't instantiate components, so components overriding allowsRefererUrlHandler() are labelled "custom at runtime".
Put it in CI: a missing JS side only shows up as "the pipeline fails at that step", long after development.
make:component
php artisan make:component MetricCard --type=component --dry-run| Option | Notes |
|---|---|
--type= | component, field or action |
--id= | Stable Catalog id; defaults to the kebab-case class name |
--label= / --category= | Catalog label and category |
--force | Overwrite existing class and view files |
--no-register | Only create files; don't change BuiltinComponents |
Other useful commands
php artisan route:list --name=renderBladephp artisan test tests/Feature/Regressionnpm run test:jsdump() / dd()
You can dump directly inside Linker methods. The content comes back with the JSON and appears as a Laravel debug panel in the bottom-right corner (with file:line), and the console prints a plain-text copy:
#[Computable]
public function create(array $args): LinkerResponse
{
$this->dump($args); // chainable
$this->dump(total: $total); // named arguments become labels
dump($something); // the global dump() is captured too and won't break the JSON
$this->dd($args); // stops this call and returns kind=debug
}dd()stores no state and doesn't advance the rev.- Prefer
$this->dd(): it goes through the normal teardown path. - At most 50 entries per response.
- Content is only sent with
APP_DEBUG=true; in production it's still intercepted but discarded.
Watching events
document.addEventListener('cg:state', e => console.log('state', e.detail.key, '→', e.detail.value));
document.addEventListener('cg:rendered', e => console.log('rendered', e.detail.root));"The screen is wrong" has only three possible causes: the key was never written, a binding didn't take effect (red text in the console), or the server's fragment was wrong to begin with.
Symptoms
| Symptom | Check first |
|---|---|
| Clicking does nothing | Does the console say the element isn't inside any @linker mount point? |
Always expired | Idle / lifetime limit reached, CSRF expired, or the user changed; reload |
Always conflict | A call carried an old rev |
policy though it should be allowed | Missing #[Computable], or the wrong arg name in #[Authorize] |
| An action didn't run | Its name isn't registered; the console says so |
state:write refused | The trigger isn't inside an @renderObject that grants state:write |
data-linker-args="form" sends nothing | The form has onsubmit="return false" or another submit handler calling preventDefault() |