Guide
PHP
The global helpers, the TALLKit facade and the Artisan commands.
Helpers
| Helper | What it does |
|---|---|
toast() |
Shows a toast: in the same response inside a Livewire action; otherwise flashed and shown by the next page rendered (this request's view, or the page after a redirect). See Toast. |
alert() |
Flashes an alert that tk:alert.session shows on the next page. See Alert. |
route_detect($routes, $parameters = null, $default = '/') |
The URL of the first route in $routes that exists. Without one it returns $default; the default '/' returns url('/'), so it keeps the app's subdirectory. |
Facade
The TALLKit facade (TALLKit\Facades\TALLKit, aliased as TALLKit, so views can use it without an import) gives the same methods (TALLKit::toast(), TALLKit::alert(), TALLKit::modal($name)->show(), TALLKit::routeDetect()) and the others the component docs name. Inside a Livewire component, $this->toast(), $this->alert(), $this->modal($name) and $this->modals() do the same; $this->modal($name) reaches only the modals that component renders. Livewire components also get $this->notificationMarkAsRead(), notificationMarkAllAsRead() and notificationDelete() (Notification), and $this->uploadPrune() and uploadKept() (Upload). A property typed as TALLKit\Livewire\DateRange holds a date range from the date picker and the calendar; see DateRange properties. The TALLKit\Livewire\ConfirmsSimilar trait and its #[Similar] attribute run the check for similar records before creating one; see Similar.
Only the methods these guides and the component docs name are stable API. The facade's other public methods exist for the package views and may change in a minor release.
Commands
| Command | Options | What it does |
|---|---|---|
php artisan tallkit:icons |
icons*, --path=*, --missing |
Fetches the icons the views use ahead of time, so they render on the first page load. Names given as arguments are fetched too; --path adds folders of views to scan. --missing only lists the icons that can't be found and fails when there are any or when Iconify does not answer. Also runs with php artisan optimize. |
php artisan tallkit:prune-uploads |
--days=1, --disk=, --dry-run |
Deletes the files sent to the upload route that nothing uses anymore, only inside tallkit.upload.directory. --days keeps files newer than that many days; --dry-run only lists them. |
Icons in CI
php artisan optimize ignores the exit code of tallkit:icons, so run php artisan tallkit:icons --missing in CI to catch icon names that don't exist.
Pruning uploads
tallkit:prune-uploads refuses to run until your app tells it which uploads are in use, in a service provider (see Upload):
Nothing to show
Then schedule it, in routes/console.php:
Nothing to show