Model/src/FieldBlueprint.php

78 lines
1.4 KiB
PHP
Raw Normal View History

2024-11-08 17:12:46 +01:00
<?php
namespace Nest\Model;
abstract class FieldBlueprint
{
protected string $type;
protected bool $primary = false;
protected bool $index = false;
protected bool $unique = false;
protected bool $required = false;
protected bool $autoIncrement = false;
protected bool $unsigned = false;
protected bool $currentDateByDefault = false;
protected bool $currentDateOnUpdate = false;
public function type(string $type): static
{
$this->type = $type;
return $this;
}
public function primary(bool $primary = true): static
{
$this->primary = $primary;
return $this;
}
public function index(bool $index = true): static
{
$this->index = $index;
return $this;
}
public function unique(bool $unique = true): static
{
$this->unique = $unique;
return $this;
}
public function required(bool $required = true): static
{
$this->required = $required;
return $this;
}
public function autoIncrement(bool $autoIncrement = true): static
{
$this->autoIncrement = $autoIncrement;
return $this;
}
public function unsigned(bool $unsigned = true): static
{
$this->unsigned = $unsigned;
return $this;
}
public function currentDateByDefault(bool $currentDateByDefault = true): static
{
$this->currentDateByDefault = $currentDateByDefault;
return $this;
}
public function currentDateOnUpdate(bool $currentDateOnUpdate = true): static
{
$this->currentDateOnUpdate = $currentDateOnUpdate;
return $this;
}
}