= 18") */ public function __construct( protected string $name, protected string $expression, ) { } /** * Set the check constraint expression. * * @param string $expression The SQL expression for the check constraint * @return $this * @throws \InvalidArgumentException */ public function setExpression(string $expression) { if (trim($expression) === '') { throw new InvalidArgumentException('Check constraint expression cannot be empty'); } $this->expression = trim($expression); return $this; } /** * Get the check constraint expression. * * @return string */ public function getExpression(): string { return $this->expression; } /** * Converts a constraint to an array that is compatible * with the constructor. * * @return array */ public function toArray(): array { return [ 'name' => $this->name, 'type' => $this->type, 'expression' => $this->expression, ]; } }