Why mutateFormDataBeforeCreate() doesn't work
protected function mutateFormDataBeforeCreate(array $data): array
{
$private = RSA::createKey(2048);
$data['private_key'] = (string)$private;
$data['public_key'] = (string)$private->getPublicKey();
//ddd($data);
return $data;
}
After I click the button 'create', I found that the field 'private_key' 'public_key' in the newest record is still null. However, the ddd($data) works when I uncommented it.
1 Reply
Solution
Maybe they are not in the $fillable array of the Model?