Support the ongoing development of Laravel.io →
posted 4 years ago
Last updated 2 years ago.
0

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.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

guestisp guestisp Joined 17 Apr 2014

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.