got a problem here. dunno how to fix
in user.php
#SQLSTATE[23000]: Integrity constraint violation: 1452 Cannot add or update a child row: a foreign key constraint fails (prism
.rfq_table
, CONSTRAINT rfq_table_userid_foreign
FOREIGN KEY (userid
) REFERENCES users
(id
) ON DELETE CASCADE ON UPDATE CASCADE) (SQL: insert into rfq_table
(projectStart
, projectEnd
, budgetMax
, budgetMin
, itemDetails
, qty
, itemName
, updated_at
, created_at
) values (1996-03-04, 1992-03-04, 50, 200, lkdad, 21, lskadkasd, 2017-03-04 07:05:08, 2017-03-04 07:05:08))
RFQ Controller.php
public function store(Request $request)
{
$user=Auth::user();
$rfq= $user->rfq_table()->create($request->all());
return redirect()->route('rfq.index');
}
User.php
public function rfq_table()
{
return $this->belongsTo(RFQ::class);
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community