| Total Complexity | 8 |
| Total Lines | 48 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 7 | class OptionType extends SingleType |
||
| 8 | {
|
||
| 9 | protected $needsTableInit = true; |
||
| 10 | protected $hasOptions = true; |
||
| 11 | |||
| 12 | public function getSchema() |
||
| 13 | {
|
||
| 14 | $schema = ""; |
||
| 15 | $schema .= "\$table->bigInteger('".$this->getForeignKey()."')->unsigned()->nullable();".PHP_EOL.$this->getTabs(3);
|
||
| 16 | $schema .= "\$table->foreign('".$this->getForeignKey()."')->references('id')->on('".$this->getPivotTable()."')->onDelete('set null');".PHP_EOL;
|
||
| 17 | return $schema; |
||
| 18 | } |
||
| 19 | |||
| 20 | public function getDbData() |
||
| 21 | {
|
||
| 22 | return explode(':',$this->optionArray[0]);
|
||
| 23 | } |
||
| 24 | |||
| 25 | public function getPivotSchema() |
||
| 26 | {
|
||
| 27 | $schema = '$table->string("title", 192);'.PHP_EOL.$this->getTabs(3);
|
||
| 28 | $schema .= '$table->timestamps();'.PHP_EOL.$this->getTabs(3); |
||
| 29 | return $schema; |
||
| 30 | } |
||
| 31 | |||
| 32 | public function getRelatedModel() |
||
| 33 | {
|
||
| 34 | return $this->getPivot(); |
||
| 35 | } |
||
| 36 | |||
| 37 | public function getPivotTable() |
||
| 40 | } |
||
| 41 | |||
| 42 | public function getMigrationPivot() |
||
| 43 | {
|
||
| 45 | } |
||
| 46 | |||
| 47 | public function getPivot() |
||
| 48 | {
|
||
| 49 | return $this->getParentModel() . $this->getChildModel(); |
||
| 50 | } |
||
| 51 | |||
| 52 | public function getTypeColumns() |
||
| 55 | } |
||
| 56 | } |
||
| 57 |