I can't get through in my code. I have error indicating that 'reservation_id' doesn't have a default value. This reservation_id of table reservation_participate_details is a foreign key from the parent table reservation's id column. I wonder if there is something to do with the hasMany or belongsTo thing. I am not yet familiar deeply on laravel.
The reservation table should/has many rows in the reservation_participate_details. The process is working before but when I changed a column (reservation_participate_id) of reservation_participate_details into reservation_id and point it as a foreign key of reservation's column id, it is now not working.
I have tried to put
public function participateDetail()
{
return $this->hasMany('App\ReservationParticipateDetail');
}
into the reservation(parent) table and
public function reservation()
{
return $this->belongsTo('\App\Reservation');
}
into the reservation_participate_detail table
I just need to save participate details into reservation_participate_details. Again, reservation table has many reservation_participate_details.
reservation_participate_details
table, you didn't set the value forreservation_id
column. – catconreservation_id
is the primary key. so you have set AUTO_INCREMENT while creating the table ? – Ankit vadariyareservation_id
in corresponding model file if not present. – coderLogs