PHP code example of meghdadfadaee / nova-row-actions

1. Go to this page and download the library: Download meghdadfadaee/nova-row-actions library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

meghdadfadaee / nova-row-actions example snippets


use Illuminate\Database\Eloquent\Model;
use MeghdadFadaee\NovaRowActions\RowActions;

public function fields(NovaRequest $request): array
{
    return [
        RowActions::make('Actions')
            ->add(
                Approve::make(),
                icon: 'check',
                iconType: 'solid',
                color: 'success',
                activeWhen: fn (Model $model) => $model->approved,
                disabledWhen: fn (Model $model) => $model->approved,
                confirm: false,
            )
            ->add(
                Reject::make(),
                icon: 'x-mark',
                color: 'danger',
                tooltip: 'Reject this record',
                visibleWhen: fn (Model $model) => ! $model->archived,
                order: 20,
                confirm: true,
            ),
    ];
}

public function actions(NovaRequest $request): array
{
    return [
        Approve::make()->exceptInline(),
        Reject::make()->exceptInline(),
    ];
}

RowActions::make('Actions')
    ->add(
        Reject::make(),
        icon: 'x-mark',
        color: 'danger',
    );