laravel-idea / plugin

Laravel Idea plugin for PhpStorm
https://laravel-idea.com/
176 stars 7 forks source link

[Bug]: custom column for the field is not recognised #715

Closed sergshumakov closed 1 year ago

sergshumakov commented 1 year ago

Bug description

I use a macro to generate uuidv7 and my field is ignored in the helper code:

Example:

public function boot()
{
    Blueprint::macro('uuid_v7', function (string $name): ColumnDefinition {
        return $this->uuid($name)->default(DB::raw('uuid_generate_v7()'));
    });
}

Migration:

return new class extends Migration
{
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->uuid_v7('id')->primary();
            $table->string('name')->nullable();
            $table->string('email')->unique();
            $table->timestampsTz();
            $table->softDeletesTz();
        });
    }
};

Helper Code:

Screenshot 2023-02-08 at 11 14 15

Plugin version

6.2.5.223

Operating system

MacOS

Steps to reproduce

No response

Relevant log output

No response

adelf commented 1 year ago

Hi, Sergey.

You can add this ide.json file to the project, and it will work with the last 6.3 version:

{
  "$schema": "https://laravel-ide.com/schema/laravel-ide-v2.json",
  "database": {
    "columnMigrationMethods": [
      {
        "name": "uuid_v7",
        "type": "string",
        "nameParameterIndex": 1,
        "defaultName": ""
      }
    ]
  }
}

Documentation for this isn't ready yet, will be available soon.

sergshumakov commented 1 year ago

It works, thank you!