Skip to main content

Blocking a route

Block a route on the API host when it has to stop at once, such as an import that overloads the database, and lift the block when it may run again:

php artisan frontline:block api.imports.store --reason="Imports overload the database."
php artisan frontline:unblock api.imports.store

Each command publishes the product sheet at once, and the gateway answers a blocked route with 503 and the code route_blocked, a stealth route with the 404 of an unknown path. When the sheet cannot go out, as while the store does not answer, the command names the reason and fails, and the block or its lifting stands all the same: the next product sheet that goes out carries it. A block is a row of the frontline_route_blocks table, so clearing a cache does not lift it, and it names its route by name: frontline:block refuses a name that is no route on the API host, and frontline:unblock lifts a block also when no route carries its name any more. To give the model relations or scopes of your own, extend \Pushery\FrontlineApi\Models\RouteBlock and name your class under models in the published config, as for the counts.