Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save aliselcuk/7c0fb1a24093566a875f94dc1f7f2c67 to your computer and use it in GitHub Desktop.

Select an option

Save aliselcuk/7c0fb1a24093566a875f94dc1f7f2c67 to your computer and use it in GitHub Desktop.
/**
* 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