If $model->save() or validation is not working

Hi guys

Sometimes $model->save() will not work.

Even worse, sometimes !$model->save() does not want to work either.

This might happen if you have a validation error for which you did not create a validation rule in the model. Such as some database errors.

For example:

User-A creates a record and enters a foreign key in the record.

While User-A is still entering the data, User-B deletes the foreign key’s record (or User-A entered a wrong foreign key).

When User-A saves the record, nothing happens and validation errors are not displayed.

To overcome this particular example use the "exist" validation rule on the foreign key; or you can have a procedure that handles database errors.

Hi,

$model->save() not working It Possible In case where you have changes View part and Removed Error but still Field is There required in

Model That time It should be Not generate Error but Model->save() not working fine beacause In that Method Model Shoud generate Proper Active record then

Working

So, please Do such changes With Model Also Then Save Method Working fine

And Always use That Method with if(!$model->save())

Thanks And Regards

Shailes makwana