Laravel Forum 5 Documentation

API - Posts

Posts

Endpoint paths are prefixed with the forum.router.prefix config value (/forum/api by default).

Parameters

Name Type Description
term String (required) The term to search for

Note

This endpoint uses a basic search implementation that works out of the box with no external dependencies, making it a good option for implementing XHR-based search on a small forum. However, due to its rudimentary nature, it’s not designed to scale well and you may wish to disable the endpoint (by setting forum.api.enable_search to false) to implement your own solution with Laravel Scout or similar.

#

Fetch recent

GET /post/recent

Returns: a collection of posts updated since forum.general.old_thread_threshold.

#

Fetch unread

GET /post/unread

Returns: a collection of threads that are updated or unread for the authenticated user.

#

Fetch

GET /post/{id:int}

Returns: the post specified by {id}.

#

Update

PATCH /post/{id:int}

Updates the post specified by {id}. See parameter list below.

Returns: the updated post object if successful.

Parameters

Name Type Description
content String (required) The post content
#

Delete

DELETE /post/{id:int}

Deletes the post specified by {id}. See parameter list below.

Returns: the deleted post object if successful.

Parameters

Name Type Description Default
permadelete Boolean Force hard-deletion Always true if soft-deletion is disabled, otherwise false
#

Restore

POST /post/{id:int}/restore

Restores the soft-deleted post specified by {id}.

Returns: the restored post object if successful.

#

Bulk delete

DELETE /bulk/post

Deletes a selection of one or more posts. Any posts not eligible for selection are left unchanged. See parameter list below.

Returns: a generic ‘success’ response if successful.

Parameters

Name Type Description Default
posts Integer array (required) IDs of posts to delete N/A
permadelete Boolean Force hard-deletion Always true if soft-deletion is disabled, otherwise false

Returns a “success” response if successful.

#

Bulk restore

Post /bulk/post/restore

Restores a selection of one or more posts. Any posts not eligible for selection are left unchanged. See parameter list below.

Returns: a generic ‘success’ response if successful.

Parameters

Name Type Description
posts Integer array (required) IDs of posts to restore