Keep soft-deleted rows off a Vue index
SoftDeletes hides deleted rows from a normal query. Do not filter them again in Vue.
SoftDeletes hides deleted rows from a normal query. Do not filter them again in Vue.
getRouteKeyName can return slug. The column has to be unique. The title is not a key.
Type-hint Post $post and the URL {post} resolves the row. A missing row is a 404.
with('author') loads the relation once. Reading it inside a loop is one query per row.
cursorPaginate needs a unique order. id is unique. A duplicated published_at skips and repeats rows.
when() adds a like query only when the search box is not empty. Bind the word. Do not paste it into SQL.
A missing post already 404s through route model binding. Do not build a second Inertia error page for it.
Send updated_at with the form and compare it before you write. Do not use HTTP 409 for that.
Inertia uses 409 when the asset version changed. The client reloads. It is not a validation error.
The kit's toast reads flash.toast. An error uses the same array with type error. with() does not reach it.
viewAny takes the model class, not a row. Call it on the index before you paginate.
role and permission middleware refuse the request. The Vue page only receives a boolean it can show.
Newsletter
One short email with new guides, release notes worth reading and hand-picked community links. No spam, unsubscribe any time.