ottopilot's avatar

Return value from query builder delete?

Decided to ask this question in the Eloquent section because inexplicably there's no generic "database" channel. Not everyone uses Eloquent.

Anyway, I'm using the query builder (not eloquent) and trying to figure out how to determine if a delete succeeds or not. What I'm expecting is a return of the number of rows that the delete affected. 0 if the delete failed, 1 to N if it succeeded. Yet neither the laravel documentation nor the API documentation explain exactly what to expect.

Can anyone confirm that delete returns the number of rows deleted?

0 likes
4 replies
ottopilot's avatar

Yea, found that too after digging into the source.

Would it have killed the devs to add a description to the return value so it was included in the API docs?

This is definitely one my biggest peeves with Laravel -- inadequate documentation.

5 likes
jekinney's avatar

The API docs are auto generated. But does give you a link to the source on github.

Little blue colored line number.

kitesurf's avatar

Agreed. and I think they try to keep it as clean as possible. but some footnotes to in-depth documentation would do wonders to expand their user base.

Please or to participate in this conversation.