Skip to content

SQLSTATE[HY000]: General error: 1364 Field 'xxx_id' doesn't have a default value  #7

@hugeps

Description

@hugeps

Basically looks like the foreign key field is not added into the SQL statement for a nested table element.
Is there anything obvious I'm missing ?

$order = new Order($x); // Naturally items in array have no ids

table is linked as follows:

public function details()
{
    return $this->hasMany('App\Detail', 'order_id');
}

there's also belong to on detail:

public function order()
{
    return $this->belongsTo('App\Order','order_id');
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions