Skip to content

Problem is with two-word model names #374

@Kikky

Description

@Kikky
  • Laravel Version: 7
  • PHP Version: 7.4
  • Blueprint Version: 1.18
  • Platform: Linux

Issue: In result I get such a table for relationship n-n:

        Schema::create('broker_broker_type', function (Blueprint $table) {
            $table->foreignId('broker_id');
            $table->foreignId('brokertype_id');
        });

The problem is with two-word model names. The second field has 'brokertype_id' name, but not 'broker_type_id'. But lavarel's backback, for example, is searching for the 'broker_type_id' field of the BrokerType model.

Will be great if Blueprint generate '_' in the fields that were processed from two-word model names. Or if it could be customizable.

P.S: Thanks for the great tool!

draft.yaml:

models:
  Models\Broker:
    name: string
    established: integer unsigned nullable
    location: string
    offices: string
    max_leverage: integer unsigned
    min_deposit: integer unsigned nullable
    spreads: integer unsigned
    logo: string
    text_company: text
    text_availability: text
    text_features: text
    text_instruments: text
    text_review: text
    timestamps: true
    softDeletes: true
    relationships:
      belongsToMany: BrokerType

  Models\BrokerType:
    name: string
    slug: string unique
    timestamps: true
    softDeletes: true
    relationships:
      belongsToMany: Broker

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions