EnumInteractsWithQueryBuilder.php
31 lines
| 1 | <?php |
| 2 | |
| 3 | namespace Give\Framework\Support\ValueObjects; |
| 4 | |
| 5 | use Give\Framework\Support\Facades\Str; |
| 6 | |
| 7 | trait EnumInteractsWithQueryBuilder |
| 8 | { |
| 9 | /** |
| 10 | * @since 2.19.6 |
| 11 | * |
| 12 | * Returns array of meta aliases to be used with attachMeta |
| 13 | * |
| 14 | * [ ['_give_payment_total', 'amount'], etc. ] |
| 15 | * |
| 16 | * @return array |
| 17 | */ |
| 18 | public static function getColumnsForAttachMetaQuery() |
| 19 | { |
| 20 | $columns = []; |
| 21 | |
| 22 | foreach (static::toArray() as $key => $value) { |
| 23 | $keyFormatted = Str::camel($key); |
| 24 | |
| 25 | $columns[] = [$value, $keyFormatted]; |
| 26 | } |
| 27 | |
| 28 | return $columns; |
| 29 | } |
| 30 | } |
| 31 |