Last active
October 11, 2017 10:24
-
-
Save deividaspetraitis/3ad70f935ed4184327e2320a3c038a90 to your computer and use it in GitHub Desktop.
Work around for error: `Table::{closure}() must be an instance of Grimzy\LaravelMysqlSpatial\Schema\Blueprint, instance of Illuminate\Database\Schema\Blueprint given, called in ...`
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
<?php | |
use Illuminate\Database\Migrations\Migration; | |
use Grimzy\LaravelMysqlSpatial\Schema\Blueprint; | |
class CreateTable extends Migration | |
{ | |
/** | |
* Run the migrations. | |
* | |
* @return void | |
*/ | |
public function up() | |
{ | |
/** @var Illuminate\Database\Schema\Builder $schema */ | |
$schema = app('db')->connection()->getSchemaBuilder(); | |
$schema->blueprintResolver(function($table, $callback) { | |
return new Blueprint($table, $callback); | |
}); | |
$schema->create('geo_regions', function(Blueprint $table) { | |
// .. | |
$table->geometry('geometry'); | |
$table->spatialIndex('geometry'); | |
// ... | |
$table->engine = 'InnoDB'; | |
}); | |
} | |
/** | |
* Reverse the migrations. | |
* | |
* @return void | |
*/ | |
public function down() | |
{ | |
Schema::dropIfExists('geo_regions'); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment