PHP code example of jorgv / nova-plus-button

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

    

jorgv / nova-plus-button example snippets



\\ use Jorgv\PlusButton\PlusButton;

public function fields()
{
    return [
            PlusButton::make('count')->increaseValue(5),
    ];
}


class YourController extends Controller
{

    public function increment(Request $request, $id)
    {
        if (request()->expectsJson()) {
            $object = Class::find($id);
            $object->count = $request->count;
            $object->save();
            return $object;
            }
    }
}  

Route::post('class/increase/{id}', 'YourController@increment');