Notifications usage

To notify a user, you can use the out of the box laravel notification system:

use Laralum\Notifications\Notifications\MessageNotification;
use Laralum\Users\Models\User;

$user = User::findOrFail(Auth::id());
$user->notify(new MessageNotification($subject, $message, $user = null));

Creating custom Notifications

To create custom notifications keep in mind the following example toDatabase method:

/**
     * Get the database representation of the notification.
     *
     * @param mixed $notifiable
     *
     * @return array
     */
    public function toDatabase($notifiable)
    {
        return [
            'subject' => $this->subject,
            'message' => $this->message,
            'user'    => $this->user,
        ];
    }

The subject, message & user are mandatory fields, where user can be null.

Did you know?

Laralum uses aitor24/localizer to change easyli the App Locale of your Laravel project.


Donations

Please consider donating if you liked the project, we currently have no funding and we're spending a lot of time maintaining and developing this project.


The creators

Èrik Campobadal Forés

Aitor Riba Archilla


Major Contributors

Krishan König

Laraketai

Snow McFox