Search code examples
phpdatabasesymfonypostgis

Call to undefined method Illuminate\Database\Schema\Blueprint::enablePostgis()


I'm trying to setup a Laravel app. I made sure i got postgis installed on my systme using brew:

$ brew install postgis
Warning: postgis 2.3.2 is already installed

and i know it’s already listed as one of the required packages in composer.json like so:

"phaza/laravel-postgis": "^3.0",

I can find it in my composer.lock as well.

yet when i run php artisan migrate I get this

[Symfony\Component\Debug\Exception\FatalThrowableError]
  Call to undefined method Illuminate\Database\Schema\Blueprint::enablePostgis()

my code looks something like this

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            ...
            $table->enablePostgis();

If I click on the jump to definition on enablePostgis it takes me here:

vendor/phaza/laravel-postgis/src/Schema/Blueprint.php

Not sure what's going on?


Solution

  • Turns out that my postgres db connection details (ie username/pwd) were incorrect! So it had nothing to do with importing libraries.. so the error message was so misleading.. sorry guys :(