Helpers (Laravel Forum 6.x)


Laravel Forum provides a utility class (specified in the forum.web.utility_class config value, TeamTeaTime\Forum\Support\Web\Forum::class by default) to facilitate a few common actions. This is automatically aliased to Forum for ease of use in views.

TeamTeaTime\Forum\Support\Api\ForumApi::class is also available and provides a route method, similar to the Forum one described below, for generating API URLs. Note that this class does not get aliased automatically.


Forum::alert('success', 'categories.updated', $categories->count());

Flashes alert messages to the session to be displayed on the next request. Note that validation messages, which follow Laravel’s convention are separate from this feature; in this context, alerts are forum-specific ‘success’ or ‘warning’ messages.



Parses the given content and returns the “rendered” version. This is used for post content by default, but could extend to category descriptions.


Forum::route('', $thread);

Wraps Laravel’s route() helper function to generate URLs for forum routes. Since the web routes contain many parameters, generating URLs for them with route() can be cumbersome, especially in views. To make this easier, Forum::route() simply accepts a route name (with or without the preceding forum.) and a Category, Thread or Post model. The route parameters are automatically extracted from the model.



Generates a URL-friendly version of the given string. By default, this simply passes the string through Laravel’s str_slug() and is used by Forum::route(). You’ll probably want to override this if your forum is going to contain categories and threads with unicode titles.