This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

NM97
NM97

Recently I started my adventure with October CMS and encountered a problem I have three tables:

-bikes https://imgur.com/a/zFgAprG

-reservation https://imgur.com/a/AdJJDGI

-bike_reservations (pivot table) https://imgur.com/a/SPfjYp8

I have created a relation between the reservation table and the bikes (in models --> Reservation.php). 'bike' => 'nm\rentalbike\models\bike'

And the relation created by the bike_reservations table (in models --> Bike.php). 'reservations' => [ 'NM\Rentalbike\Models\reservation', 'table' => 'nm_rentalbike_bike_reservations', 'order' => 'pickup' ]"

I have a form defined in the "Bike" module and in it I have a field "Reserved". https://imgur.com/a/xuTkYBS

To it the value is taken from the "pickup" column of the reservation table. And here's my question on how I can create an automatization that will make sure that if there is a new record and bike_id=1 in the reservation table then in the "Bike" form (for a bike with id=1) this date will be marked in the "Reserved" field.

Last updated

NM97
NM97

In short, it needs a hint how to add a record to the reservation table after adding it to the bike_reservation table (id_reservation and id_bike).

Last updated

1-2 of 2

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.