定制 accelade/actions 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

accelade/actions

Composer 安装命令:

composer require accelade/actions

包简介

Action buttons and modals for Accelade - Filament-style actions with Blade templates

README 文档

README

Filament-Style Actions for Accelade

Tests Latest Version Total Downloads License

Build interactive action buttons with modals, confirmations, and server-side execution - all using Accelade's reactive Blade components.

use Accelade\Actions\Action;
use Accelade\Actions\DeleteAction;

// Simple action button
Action::make('save')
    ->label('Save Changes')
    ->icon('check')
    ->color('success')
    ->url(route('posts.store'));

// Delete with confirmation
DeleteAction::make()
    ->url(fn ($record) => route('posts.destroy', $record))
    ->requiresConfirmation()
    ->modalHeading('Delete Post')
    ->modalDescription('Are you sure? This cannot be undone.');

Features

  • Fluent API — Filament-style action builder with chainable methods
  • Confirmation Modals — Built-in confirmation dialogs with customizable text
  • Server Actions — Execute closures on the server via secure AJAX
  • SPA Navigation — Integrates with Accelade's SPA navigation system
  • Multiple Variants — Button, link, and icon-only styles
  • Color Schemes — Primary, secondary, success, danger, warning, info
  • Action Groups — Dropdown menus for multiple actions
  • Authorization — Closure-based authorization checks

Installation

composer require accelade/actions

The package auto-registers with Laravel. To publish assets:

php artisan actions:install

Add to your layout:

<head>
    @actionsStyles
</head>
<body>
    {{ $slot }}

    @actionsScripts
</body>

Quick Start

Basic Action Button

@php
    $action = Action::make('edit')
        ->label('Edit')
        ->icon('pencil')
        ->color('primary')
        ->url(route('posts.edit', $post));
@endphp

<x-actions::action :action="$action" />

Delete with Confirmation

@php
    $deleteAction = DeleteAction::make()
        ->url(route('posts.destroy', $post));
@endphp

<x-actions::action :action="$deleteAction" :record="$post" />

Server-Side Action

@php
    $action = Action::make('publish')
        ->label('Publish')
        ->icon('check')
        ->color('success')
        ->requiresConfirmation()
        ->action(function ($record, $data) {
            $record->update(['published_at' => now()]);
            return ['message' => 'Post published!'];
        });
@endphp

<x-actions::action :action="$action" :record="$post" />

Action Types

Type Description
Action Standard action button
ViewAction Navigate to view page
EditAction Navigate to edit page
CreateAction Navigate to create page
DeleteAction Delete with confirmation
ActionGroup Dropdown menu of actions

Colors

->color('primary')   // Indigo
->color('secondary') // Gray
->color('success')   // Green
->color('danger')    // Red
->color('warning')   // Yellow
->color('info')      // Cyan

Variants

// Standard button (default)
->button()

// Text link style
->link()

// Icon-only button
->iconButton()

// Outlined style
->outlined()

Sizes

->size('xs')  // Extra small
->size('sm')  // Small
->size('md')  // Medium (default)
->size('lg')  // Large
->size('xl')  // Extra large

Confirmation Modal

Action::make('delete')
    ->requiresConfirmation()
    ->modalHeading('Delete Record')
    ->modalDescription('Are you sure you want to delete this?')
    ->modalSubmitActionLabel('Yes, Delete')
    ->modalCancelActionLabel('Cancel')
    ->confirmDanger();

Action Groups

@php
    $group = ActionGroup::make([
        ViewAction::make()->url(route('posts.show', $post)),
        EditAction::make()->url(route('posts.edit', $post)),
        DeleteAction::make()->url(route('posts.destroy', $post)),
    ])->tooltip('Actions');
@endphp

<x-actions::action-group :group="$group" :record="$post" />

Authorization

Action::make('delete')
    ->authorize(fn ($record) => auth()->user()->can('delete', $record))
    ->hidden(fn ($record) => $record->is_protected);

Documentation

Guide Description
Getting Started Installation and setup
Actions Building action buttons
Modals Confirmation dialogs
API Reference Complete API docs

Requirements

  • PHP 8.2+
  • Laravel 11.x or 12.x
  • Accelade 0.1+

License

MIT License. See LICENSE for details.

统计信息

  • 总下载量: 419
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 2
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-01-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固