Foreword

The new version-4 comes with a whole new code base and a lot of breaking changes. We will try to document all the things that have changed to guide you the best through the upgrade process but please be kind if we missed something.

Upgrade Guide

Configuration File

We have changed the way how translations are working to get close to the laravel way. To achieve this we have changed the old translations where all translations are stored to a simple translation.enabled to enable/disable the translations itself and translation.domain to tell us how your translation file is called.

Notifable Trait

Here we have some of the most changes first we have moved the Trait from Fenos\Notifynder\Notifable to Fenos\Notifynder\Traits\Notifable. Second we have dropped some methods in the trait:

kept

  • notifications() relationship
  • getNotifications($limit, $order) but removed $paginate and $filterScope
  • readAllNotifications() read all notifications received by this model

added

  • notifynder($category) get a Notifynder Builder instance with a given category
  • sendNotificationFrom($category) get a Notifynder Builder instance with a given category and the model as sender
  • sendNotificationTo($category) get a Notifynder Builder instance with a given category and the model as receiver
  • readNotification($notification) read a single notification
  • unreadNotification($notification) unread a single notification

renamed

  • countNotificationsNotRead($filterScope) to countUnreadNotifications() and dropped the $filterScope

dropped

  • getNotificationsNotRead($limit, $paginate, $order, $filterScope)
  • getLastNotification($category, $filterScope)
  • readLimitNotifications($numbers, $order)
  • deleteLimitNotifications($numbers, $order)
  • deleteAllNotifications()

Notifynder Facade

The new facade is reduced to the total basics, we have dropped or moved about 40 methods to remove duplicate code and make it more understandable where is what done. Cause we have changed this much and not everything that is removed is really away we wont give you a full list of what is different. Please take a look in the examples of the new version to see how the new facade is used.

Notification Builder

The Builder, the class that creates the notifications, has also got some reworks but hasn't changed this much. Most important change is that we now create a real object Fenos\Notifynder\Builder\Notification and no more arrays. This will help you if you want to create a custom sender or something like this.

Sender Manager

This is something really new, not the name but the behaviour. The new Fenos\Notifynder\Managers\SenderManager is the core of the sending process. It holds all senders that are registered, also the default ones. This way you can simply override the default senders and we don't have the problem that we register the default senders in a different way.

Migrations

We have made the from_id nullable to allow anonymous notifications, a new method on the Builder is also added. The expire_time column on the notifications table is renamed to expires_at to get closer to laravel standards.

CategoryGroups

This feature has been dropped - if you need it we recommend you to rebuild it in the laravel way with events and listeners.


If you have something to add pls make a PR in the documentation repository: https://github.com/Astrotomic/notifynder-documentation