Grammars
3 weeks ago
Blueprint.php
3 weeks ago
Builder.php
3 weeks ago
ColumnDefinition.php
3 weeks ago
ForeignIdColumnDefinition.php
3 weeks ago
ForeignKeyDefinition.php
3 weeks ago
IndexDefinition.php
3 weeks ago
MySqlBuilder.php
3 weeks ago
MySqlSchemaState.php
3 weeks ago
PostgresBuilder.php
3 weeks ago
PostgresSchemaState.php
3 weeks ago
SQLiteBuilder.php
3 weeks ago
SchemaState.php
3 weeks ago
SqlServerBuilder.php
3 weeks ago
SqliteSchemaState.php
3 weeks ago
ForeignKeyDefinition.php
72 lines
| 1 | <?php |
| 2 | |
| 3 | namespace IAWPSCOPED\Illuminate\Database\Schema; |
| 4 | |
| 5 | use IAWPSCOPED\Illuminate\Support\Fluent; |
| 6 | /** |
| 7 | * @method ForeignKeyDefinition deferrable(bool $value = true) Set the foreign key as deferrable (PostgreSQL) |
| 8 | * @method ForeignKeyDefinition initiallyImmediate(bool $value = true) Set the default time to check the constraint (PostgreSQL) |
| 9 | * @method ForeignKeyDefinition on(string $table) Specify the referenced table |
| 10 | * @method ForeignKeyDefinition onDelete(string $action) Add an ON DELETE action |
| 11 | * @method ForeignKeyDefinition onUpdate(string $action) Add an ON UPDATE action |
| 12 | * @method ForeignKeyDefinition references(string|array $columns) Specify the referenced column(s) |
| 13 | * @internal |
| 14 | */ |
| 15 | class ForeignKeyDefinition extends Fluent |
| 16 | { |
| 17 | /** |
| 18 | * Indicate that updates should cascade. |
| 19 | * |
| 20 | * @return $this |
| 21 | */ |
| 22 | public function cascadeOnUpdate() |
| 23 | { |
| 24 | return $this->onUpdate('cascade'); |
| 25 | } |
| 26 | /** |
| 27 | * Indicate that updates should be restricted. |
| 28 | * |
| 29 | * @return $this |
| 30 | */ |
| 31 | public function restrictOnUpdate() |
| 32 | { |
| 33 | return $this->onUpdate('restrict'); |
| 34 | } |
| 35 | /** |
| 36 | * Indicate that deletes should cascade. |
| 37 | * |
| 38 | * @return $this |
| 39 | */ |
| 40 | public function cascadeOnDelete() |
| 41 | { |
| 42 | return $this->onDelete('cascade'); |
| 43 | } |
| 44 | /** |
| 45 | * Indicate that deletes should be restricted. |
| 46 | * |
| 47 | * @return $this |
| 48 | */ |
| 49 | public function restrictOnDelete() |
| 50 | { |
| 51 | return $this->onDelete('restrict'); |
| 52 | } |
| 53 | /** |
| 54 | * Indicate that deletes should set the foreign key value to null. |
| 55 | * |
| 56 | * @return $this |
| 57 | */ |
| 58 | public function nullOnDelete() |
| 59 | { |
| 60 | return $this->onDelete('set null'); |
| 61 | } |
| 62 | /** |
| 63 | * Indicate that deletes should have "no action". |
| 64 | * |
| 65 | * @return $this |
| 66 | */ |
| 67 | public function noActionOnDelete() |
| 68 | { |
| 69 | return $this->onDelete('no action'); |
| 70 | } |
| 71 | } |
| 72 |