Skip to content

How it works

Pe Ell edited this page Apr 17, 2017 · 1 revision

Eloquent Flag is an easy way to add flagged attributes to eloquent models. All flags has their own trait which adds global scopes to desired entity.

There are 2 types of flags:

  • Boolean flags are the common ones. Stored in database as BOOLEAN or TINYINT(1) value.
  • Timestamp flags represented in database as nullable TIMESTAMP column. Useful when you need to know when action was performed.

All flags separated on 2 logical groups:

  • Classic flags displays only entities with true or timestamp flag value.
  • Inverse flags displays only entities with false or null flag value.

Omitted entities could be retrieved by using special global scope methods, unique for each flag.