Skip to main content
After your Resource is live, CRUD methods are the next level of control. Exo supports creating, updating, and deleting records through the API, and you can tune behavior with validation rules and perform methods.

Creating records

Validation rules

Define the rules for creating a record in the createRules method:
These are standard Laravel validation rules. When a POST request comes in, Exo validates the request body against these rules before creating the record.

Custom create logic

By default, Exo calls Model::create() with the validated data. If your resource has an ownerColumn, Exo automatically sets it to the authenticated user’s ID. Override performCreate when you need custom logic — for example, hashing a password or creating related records:

Updating records

Validation rules

Define update rules in updateRules. Use sometimes to make fields optional (so users can update a single field without sending everything):
The $model parameter lets you reference the current record — useful for unique rules that need to ignore the current row.

Custom update logic

Override performUpdate for custom behavior:

Deleting records

Deletion doesn’t need validation rules — Exo checks authorization and then calls $model->delete(). If the user is authorized (admin or owner), the record is deleted and a 204 No Content response is returned.

Disabling operations

You can disable any operation by returning false from the corresponding support method:
When a disabled operation is attempted, the API returns 405 Method Not Allowed.

Complete example

Here’s a resource with full CRUD support: