PHP code example of dnwjn / nova-button

1. Go to this page and download the library: Download dnwjn/nova-button 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/ */

    

dnwjn / nova-button example snippets


use Dnwjn\NovaButton\Button;

public function fields(Request $request)
{
    return [
        ID::make('ID', 'id')->sortable(),
        Text::make('Name', 'name'),
        Button::make('Notify'),
    ];
}

Button::make('Cancel Account')->confirm('Are you sure?'),
Button::make('Cancel Account')->confirm('Confirmation', 'Are you sure you want to cancel your account?'),
Button::make('Cancel Account')->confirm('Confirmation', 'Are you sure you want to cancel your account?', 'Cancel'),

Button::make('Notify')->reload()

Button::make('Notify', 'notify-some-user')

Button::make('Notify')->event(App\Events\NotifyRequested::class)

Button::make('Notify', 'notify-some-user')
    ->emit('notification', ['article_id' => 1, 'which' => 'tags'])

Button::make('Notify')->title('Button title')

Button::make('Notify')->label('Button label')

Button::make('Notify')->indexName('Actions')

Button::make('Activate')->visible($this->is_active === false),
Button::make('Deactivate')->visible($this->is_active === true),

Button::make('Notify')->visible($request->user()->can('notifyUser', $this))

Button::make('Notify')->showOnCreating()->showOnUpdating()

Button::make('Notify')->disabled()
Button::make('Notify')->disabled($this->is_complete === false)

Button::make('Notify')
    ->loadingText('Sending...')
    ->successText('Sent!')
    ->errorText('Something went wrong...')

Button::make('Text')->route('vuejs-route-name', ['id' => 1])
Button::make('Text')->index(App\Nova\User::class)
Button::make('Text')->detail(App\Nova\User::class, $this->user_id)
Button::make('Text')->create(App\Nova\User::class)
Button::make('Text')->edit(App\Nova\User::class, $this->user_id)

Button::make('Text')
    ->route('home')
    ->withParams(['referrer' => 'nova'])

Button::make('Text')
    ->index(App\Nova\Order::class)
    ->withFilters([
        App\Nova\Filters\UserOrders::class => $this->user_id,
        App\Nova\Filters\OrderStatus::class => 'active',
    ])

Button::make('Text')->link('https://nova.laravel.com')
Button::make('Text')->link('https://nova.laravel.com', '_self')

// One class
Button::make('Notify')->classes('some-class')

// Or multiple classes
Button::make('Notify')->classes('some-class', 'another-class')

Button::make('Delete')->style('danger')
bash
php artisan vendor:publish --tag="nova-button-config"