mardi 5 mars 2019

Laravel migration repeated FK of same Forign table

The warehouse has an accounts linked to it as followed

Schema::create('warehouses', function (Blueprint $table) {
    $table->bigIncrements('id');
    $table->string('title', 32);
    $table->string('sales_account_id');
    $table->string('promotions_account_id');
    $table->string('damages_account_id');

    $table->string('address')->nullable();
    $table->string('phones')->nullable();
    $table->string('fax', 12)->nullable();
    $table->string('email')->nullable();

    $table->engine = 'InnoDB';
    $table->charset = 'utf8';
    $table->softDeletes();
    $table->timestamps();
});

How can I link sales, promotion and damages accounts to same Accounts table in smooth way, like hasOne / hasMany ??



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire