How to use php8 enum types in Laravel where conditions?

20 views Asked by At

I have a php8 enum type

enum OperationTypes: string
{
    case PointsAdd = 'points-add';
}

I need to be sure how to properly use it in Laravel database querybuilder. For example:

Model::where('type', OperationTypes::PointsAdd)
or 
Model::where('type', OperationTypes::PointAdd->value)

Model::whereIn('type', [OperationTypes::PointAdd])
or
Model::whereIn('type', [OperationTypes::PointAdd->value])

What is correct way?

0

There are 0 answers