Created
November 6, 2018 00:53
-
-
Save aliselcuk/7c0fb1a24093566a875f94dc1f7f2c67 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Create a second table for translations if schema is translatable | |
| */ | |
| if (false) { | |
| $blueprint = $this->createBlueprint($table.'_translations'); | |
| $blueprint->create(); | |
| $blueprint->increments('id'); | |
| $blueprint->unsignedInteger('entry_id'); | |
| $blueprint->string('locale'); | |
| collect($mainBlueprint->getColumns()) | |
| ->map(function (Fluent $column) use ($blueprint) { | |
| if (in_array($column->type, ['string', 'text'])) { | |
| $attrs = $column->getAttributes(); | |
| $blueprint->addColumn( | |
| array_pull($attrs, 'type'), | |
| array_pull($attrs, 'name'), | |
| $attrs | |
| ); | |
| } | |
| }); | |
| $this->build($blueprint); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment