Welcome to the Cookbook

loading...
Please login to continue

3.7.5.1 delete

delete(int $id = null, boolean $cascade = true);

Deletes the record identified by $id. By default, also deletes records dependent on the record specified to be deleted.

For example, when deleting a User record that is tied to many Recipe records:

  • if $cascade is set to true, the related Recipe records are also deleted if the models dependent-value is set to true.
  • if $cascade is set to false, the Recipe records will remain after the User has been deleted.