Skip to main content

Commands

Lact provides helpful Artisan commands to streamline setup, routing, and interaction between your JavaScript front end and Laravel back end. Below is a list of all available commands, along with what they do, when to use them, and example usage.

$ php artisan lact run

Processes and builds actions for registered URLs in the application

It performs the following tasks:

  • Clears the existing routes file generated by Lact.
  • Parse controller methods that use a specific Action attribute and build route strings for them.
  • Delete the previously generated actions directory to ensure a clean slate.
  • Iterates through all action URLs, processes each route by HTTP method and generates corresponding JavaScript methods.
  • Ensures the generated routes and methods are appended to the appropriate files.

Use this command to automate the generation of routes and associated frontend methods for dynamic or static actions based on your application's URL structure.

When to use

  • Run this once after setup.
  • Run this in case you want to manually regenerate the function definitions in JS.

Usage

php artisan lact:run

$ php artisan lact clear

  • This command is used to clear the routes file and remove the Action directory.
  • It ensures that the necessary cleanup is performed for the LACT (Laravel Action Command Tool) package.

When to use

Run this command when you have to clean all definition, it's like cache:clear.

Usage

php artisan lact:clear