Maybe start with a Condition interface for your models.
Create models and tables for boolean operations: not, and, or. Not will have one polymorphic condition, the others many.
Have 'value providers'. For example a temperature provider class.
Implement comparators implementing the condition interface. You can have an Integer comparator. When saving it to the database you save the comparison method '<=', the value to compare agains (10), the polymorphic device it refers to (device id 2) and the name of the value provider class.
In a similar fashon you can define actions to be executed when the conditions are met.
Sign in to participate in this thread!
We'd like to thank these amazing companies for supporting us
The Laravel portal for problem solving, knowledge sharing and community building.