Laravel People, help please

Soldato
Joined
18 Oct 2002
Posts
7,635
Location
Sutton Coldfield, Birmingham
I have an Eloquent model that I want to have some sort of notification system on and i'm not sure what's the best way to achieve this.

The model is called 'Tenancy' and I want to be able to record whether an item is overdue, owes rent, is ending soon, etc. So basically a wide array of different events with the ability to add more at a later date if needs me.

I want to be able to search through each of the events that have been triggered against a tenancy so that I can show just the overdue tenancies for example.

Each Tenancy has a number of relations and when updating these, i'd need to the tenancy to check whether a notice needs to be removed, updated or added.

I've toyed with the idea of simply using a method inside the eloquent model to check for and return the different events which works OK to display them and has the benefit of not requiring lots of inserts, updates and deletes on the database itself. Trouble is I cannot perform searches against this without grabbing all of the results before hand.

Second idea was to have a JSON field against each tenancy to store data relating to any events. This is searchable but would need constant updates, deletes on the many numerous relations to the tenancy model.

Any other suggestions?
 
Back
Top Bottom