{
### [Custom Notification Channels](#custom-notification-channels)
-If you want to write your own channels to deliver a notification, you can easily do so by extending a
-`NotificationChannel` class and overriding `send()` method.
+If you want to write your own channels to deliver a notification, you can easily do so by
+extending a `NotificationChannel` class and overriding the `send()` method.
+
+Let's say we want to write a custom channel called `TextChannel` that delivers a notification to a
+user via SMS text. Let's see a complete example of how we go can about writing such a custom
+channel ourselves in few easy steps.
-Let's say we want to write a custom channel called `TextChannel` that delivers a notification to a user via SMS text.
-Let's see a complete example of how we go can about writing such a custom channel ourselves in few easy steps.
+
-
+1. Create a channel and related classes:
+
+
```kotlin
-// TextChannel.kt
class TextChannel : NotificationChannel {
override fun send(notification: Notification, notifiable: T) {
val textNotification = notification as TextableNotification
@@ -194,25 +218,22 @@ class TextChannel : NotificationChannel {
}
}
-// TextableNotification.kt
interface TextableNotification : Notification {
fun toText(notifiable: T): TextMessage
}
-// TextMessage.kt
data class TextMessage(val number: Int, val message: String)
```
-Once we have our own channel, using it is very simple:
+2. Once we have our own channel, using it is very simple:
-
+
```kotlin
-// notifications/PostLiked.kt
class PostLiked : TextableNotification {
override fun channels(user: User): List> {
return listOf(TextChannel::class)
@@ -226,3 +247,5 @@ class PostLiked : TextableNotification {
```
+
+
diff --git a/src/main/resources/docs/password-reset.md b/src/main/resources/docs/password-reset.md
index ac04f03..57c3a21 100644
--- a/src/main/resources/docs/password-reset.md
+++ b/src/main/resources/docs/password-reset.md
@@ -34,7 +34,7 @@ in the table. If not, you need to migrate your tables using `db:migrate` command
```bash
-alpas db:migrate
+$ alpas db:migrate
```
diff --git a/src/main/resources/docs/queues.md b/src/main/resources/docs/queues.md
index 9c977e8..91a72f8 100644
--- a/src/main/resources/docs/queues.md
+++ b/src/main/resources/docs/queues.md
@@ -13,10 +13,10 @@
- [Selecting Queues](#selecting-queues)
- [Waiting for Jobs](#waiting-for-jobs)
-Alpas makes it easy to defer time-consuming tasks to a queue for processing it later. You could choose one of the
-many queues bundled with Alpas or create one of your own. No matter what you choose, it abstracted them away
-behind a cohesive set of APIs. You can easily switch between different queue backends without having to
-change your code.
+Alpas makes it easy to defer time-consuming tasks to a queue for processing it later. You can choose
+one of the many queues bundled with Alpas or create one of your own. No matter what you choose,
+Alpas abstracts them away behind a cohesive set of APIs. You can easily switch between
+different queue backends without having to change your code.
The backends for queues are called `connections` in Alpas such as `DatabaseQueueConnection`. Each connection
could have multiple queues that you could selectively use for queuing different tasks most possibly
@@ -27,12 +27,13 @@ based on their priorities such as *high priority queue*, *low priority queue* et
If you open `configs/Queue.kt`, you'll notice that Alpas has lazily registered three queue connections for you.
Each connection is registered with a name. Alpas uses this key to pick one of these connections based on
-the value of `QUEUE_CONNECTION` in your `.env` file. This is set to `passthrough` by default. Feel free
-to register more queue connections or remove the ones that you know for sure you would't use.
+the value of `QUEUE_CONNECTION` in your `.env` file. This is set to `passthrough` by default.
+
+Feel free to register more queue connections or remove the ones that you know for sure you would't use.
Once you are happy with your queue connections, make sure to register `QueueServiceProvider::class`
-by [adding it to the list of service providers](/docs/service-providers#registering) in both of
-the kernel classes—`HttpKernel` and `ConsoleKernel`.
+by [adding it to the list of service providers](/docs/service-providers#registering) in both
+kernel classes—`HttpKernel` and `ConsoleKernel`.
### [Jobs](#jobs)
@@ -40,8 +41,8 @@ the kernel classes—`HttpKernel` and `ConsoleKernel`.
#### [Creating Jobs](#creating-jobs)
-A job is just a serializable task with some metadata that you wish to process later. The metadata is used during
-the processing of the task once it is dequeued from the backend.
+A job is just a serializable task with some metadata that you want to process later. The
+metadata is used during the processing of the task once it is de-queued from the backend.
Here's a real example of a job that is used when [sending a mail](/docs/mail) such as when
[resetting passwords](/docs/password-reset).
@@ -65,8 +66,8 @@ class SendMailJob(val mail: MailMessage) : Job() {