Skip to content

Instantly share code, notes, and snippets.

@deividaspetraitis
Last active October 11, 2017 10:24
Show Gist options
  • Save deividaspetraitis/3ad70f935ed4184327e2320a3c038a90 to your computer and use it in GitHub Desktop.
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 ...`
<?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