Using callbackBeforeInsert with parameter

Hello. How to use callbackBeforeInsert with parameter ?
Example :
Public function($id1, $id2){
$crud->callbackBeforeInsert(function ($stateParameters) {
// i wanna use $id1 and $id2 here, but didn’t work
return $stateParameters;
});
}

hello @heruprambadi
did you try using use syntax

$crud->callbackBeforeInsert(function ($stateParameters) use ($id2,$id2) {
    $callbackAfterInsertModel->updateCustomerName($stateParameters->insertId);
    // id1 and id2 should available here

    return $stateParameters;
});

regards
Nasrul

that’s the answer ! Thanks @nasrul :smiley: