greglamb / laravel-postgis-database

An extended Postgres driver for Laravel 4 that provides support for PostGIS features
14 stars 13 forks source link

How to... #3

Open santiagogg opened 10 years ago

santiagogg commented 10 years ago

It would be good to include an example... I can't make it work

I'm getting this error: Argument 1 passed to CreatePoligonosTable::{closure}() must be an instance of Lamb\LaravelPostgisDatabase\PostgisBlueprint, instance of Illuminate\Database\Schema\Blueprint given

with this migration:

<?php
use Illuminate\Database\Migrations\Migration;
use Lamb\LaravelPostgisDatabase\PostgisBlueprint as Blueprint;

class CreatePoligonosTable extends Migration {

    public function up()
    {
    Schema::create('poligonos', function(Blueprint $table) {
            $table->string('id', 36)->primary();
           ....
            $table->polygon('poligono');
        });
    }

....
privixtodd commented 10 years ago

I don't know if you found the problem or not - but I just hit this. The solution is to add 'use Closure;' to the top of the PostgisBuilder file. As below.

<?php namespace Lamb\LaravelPostgisDatabase;

use Illuminate\Database\Schema\Builder;
use Closure;

class PostgisBuilder extends Builder {

    protected function createBlueprint($table, Closure $callback = null)
    {
        return new PostgisBlueprint($table, $callback);
    }
}