Hi,
I add public property to model and try to initialize this property from posted form.
$model->attributes=$_POST['Menu'];
but my public proterty doesn’t get value. Any idea ? How can I add new attribute a model.
Thanks
Hi,
I add public property to model and try to initialize this property from posted form.
$model->attributes=$_POST['Menu'];
but my public proterty doesn’t get value. Any idea ? How can I add new attribute a model.
Thanks
You have to define your property as safe in the validation rules cause you are doing a massive assignment.
See:
Guide - Securing attribute assignments
Wiki - Understanding "Safe" validation rules
There is also a wiki article about virtual attributes which might help you.