callbackAfterUpdate

callbackAfterUpdate(callable $callback)

The callback that will be used right after the update of the data. There are basically two types of values that the developer will receive from the callback:

  1. The primaryKeyValue: This is the primary key value that the update took place.
  2. The data: These are the filtered data from the update

More specifically, below you can see an example of the $stateParameters variable for the callbackAfterInsert:

$stateParameters = (object)[
    'primaryKeyValue' => '1234', //primary key value
    'data' => [ // data to update
        'customerName' => 'John',
        'phone' => '1234567890',
        ...
    ]
];

A full example is also available for you to understand better:

$crud->setTable('offices');
$crud->setSubject('Office', 'Offices');
$crud->columns(['city','country','phone','addressLine1','postalCode']);

$crud->callbackAfterUpdate(function ($stateParameters) use ($callbackAfterUpdateModel) {
    $callbackAfterUpdateModel->officesAfterUpdate($stateParameters->primaryKeyValue);

    return $stateParameters;
});

The result of the above code can be found here: