laravilt/actions
Composer 安装命令:
composer require laravilt/actions
包简介
Complete action system with modal support, authorization, and Inertia.js integration. Build interactive UI components with buttons, links, and icon buttons. Includes confirmation modals, custom forms, and secure token-based execution.
README 文档
README
Laravilt Actions
Complete action system with modal support, authorization, and Inertia.js integration for Laravilt. Build interactive UI components with buttons, links, and icon buttons. Includes confirmation modals, custom forms, password protection, and secure token-based execution.
Features
- 🎨 Multiple Variants - Button, link, and icon button styles
- 🔒 Authorization - Closure-based authorization with record-level checks
- 📊 Modal Support - Confirmation modals, custom forms, slide-overs
- 🎯 Flexible Configuration - Colors, icons, sizes, tooltips
- 🔗 URL Handling - External URLs, internal actions, new tab support
- ⚡ Inertia Integration - Seamless Vue 3 integration
- 📤 Export/Import - Excel/CSV export and import with Laravel Excel
- 🔄 Soft Delete Support - Built-in restore and force delete actions
Action Types
| Type | Description |
|---|---|
Action |
Standard action button |
BulkAction |
Action for multiple selected records |
ViewAction |
Navigate to view page |
EditAction |
Navigate to edit page |
DeleteAction |
Soft delete record |
CreateAction |
Navigate to create page |
ReplicateAction |
Duplicate a record |
RestoreAction |
Restore soft-deleted record |
ForceDeleteAction |
Permanently delete record |
ExportAction |
Export data to Excel/CSV |
ImportAction |
Import data from Excel/CSV |
DeleteBulkAction |
Bulk soft delete |
RestoreBulkAction |
Bulk restore |
ForceDeleteBulkAction |
Bulk permanent delete |
Colors
->color('primary') // Blue ->color('secondary') // Gray ->color('success') // Green ->color('danger') // Red ->color('warning') // Yellow ->color('info') // Light blue
Modal Types
// Confirmation modal ->requiresConfirmation() ->modalHeading('Delete User') ->modalDescription('Are you sure?') // Form modal ->schema([ TextInput::make('reason')->required(), ]) // Slide-over ->slideOver()
Installation
composer require laravilt/actions
The package will automatically register its service provider.
Quick Start
use Laravilt\Actions\Action; $action = Action::make('delete') ->label('Delete') ->icon('trash-2') ->color('danger') ->requiresConfirmation() ->modalHeading('Delete User') ->modalDescription('Are you sure?') ->action(function ($record) { $record->delete(); });
Export & Import
use Laravilt\Actions\ExportAction; use Laravilt\Actions\ImportAction; // Export with custom exporter class ExportAction::make() ->exporter(UserExporter::class) ->fileName('users.xlsx'); // Import with custom importer class ImportAction::make() ->importer(UserImporter::class);
Soft Delete Actions
use Laravilt\Actions\DeleteAction; use Laravilt\Actions\RestoreAction; use Laravilt\Actions\ForceDeleteAction; // Auto-hidden for trashed records DeleteAction::make(); // Auto-visible only for trashed records RestoreAction::make(); ForceDeleteAction::make();
Replicate Action
use Laravilt\Actions\ReplicateAction; ReplicateAction::make() ->excludeAttributes(['slug', 'published_at']) ->beforeReplicaSaved(fn ($replica) => $replica->name .= ' (Copy)') ->afterReplicaSaved(fn ($replica) => /* post-save logic */);
Generator Commands
# Generate an action class php artisan make:action ExportUserAction # Generate an exporter class for ExportAction php artisan laravilt:exporter UserExporter php artisan laravilt:exporter CustomerExporter --model=Customer # Generate an importer class for ImportAction php artisan laravilt:importer UserImporter php artisan laravilt:importer CustomerImporter --model=Customer
Documentation
- Complete Documentation - Full feature guide, API reference, and examples
- MCP Server Guide - AI agent integration
Configuration
Publish the config file:
php artisan vendor:publish --tag="laravilt-actions-config"
Assets
Publish the plugin assets:
php artisan vendor:publish --tag="laravilt-actions-assets"
Testing
composer test
Code Style
composer format
Static Analysis
composer analyse
License
The MIT License (MIT). Please see License File for more information.
laravilt/actions 适用场景与选型建议
laravilt/actions 是一款 基于 HTML 开发的 Composer 扩展包,目前已累计 671 次下载、GitHub Stars 达 0, 最近一次更新时间为 2025 年 11 月 12 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「authorization」 「laravel」 「buttons」 「actions」 「modals」 「vue」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 laravilt/actions 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 laravilt/actions 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 laravilt/actions 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Adds new form actions and buttons to GridField detail form for usability enhancements.
Simple Contao extension to provide share buttons as a module and content element
Ory-Hydra OAuth 2.0 Client Provider for The PHP League OAuth2-Client
Craft CMS plugin to add a radio buttons field, customizable with CSS classes, icons, images and text.
A lightweight and powerful OAuth 2.0 authorization and resource server library with support for all the core specification grants. This library will allow you to secure your API with OAuth and allow your applications users to approve apps that want to access their data from your API.
A Laravel Nova asset.
统计信息
- 总下载量: 671
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 32
- 依赖项目数: 4
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2025-11-12
