Welcome Guest, Not a member yet? Register   Sign In
Missing data in $beforeUpdate callback function
#1

Hello! 
I try to create a
Code:
$beforeUpdate
 callback function to change date format for database:
Code:
protected $beforeUpdate = ['changeDateFormat'];

And when i try to check the incoming data, then i see that many fields are missing:
Code:
public function changeDateFormat(array $data)
{
        dd($data['data']);
}
It has only three fields: [id, fk_loan_id, updated_at], but it should have many more fields, like: base_data, loan_balance etc. 
Why can't i see all the values and how can i fix it?

Thank you for any help!
Reply
#2

All fields must be specified in the $allowedFields class property. And also if they are changed.
Reply
#3

(04-27-2023, 11:06 AM)iRedds Wrote: All fields must be specified in the $allowedFields class property. And also if they are changed.

I understand that, but i have these fields declared in allowedFields property:

PHP Code:
protected $allowedFields = [
        'foo'
        'bar',
        'baz',  
        
'id',
        'fk_loan_id',
        'another_field',
]; 
Reply




Theme © iAndrew 2016 - Forum software by © MyBB