[ad_1]
I’m create one enum, and I added one condition:
<?php
declare(strict_types=1);
namespace App\Enums;
use App\Models\collections;
enum ServiceColections : string {
case POS = (isset(collections::first()))? 'POS' : '';
}
the condition is the following if there are items in the database(table collections), so create case POS, but if they don’t exist don’t create.
currently I’m having this error: Enum case value must be compile-time evaluatable
why it dont work?
[ad_2]