Skip to main content
100%

sample action

✓ Published0🌍 Public
Aallyraza
Last edited Nov 19, 2014
Created on Nov 19, 2014

This example shows a PHP controller action that handles event registration by creating a new Registration model instance, saving user-submitted form data, and then decrementing the corresponding event’s available seat count. It first checks for a POST request, assigns the submitted attributes to the model, and saves it. If successful, it retrieves the related Event record via `Event::model()->findByPk()`, subtracts the number of seats requested, and updates the event before redirecting. The code relies on Yii’s ActiveRecord pattern, using the `Registration` and `Event` models, without any client-side visualization or charting libraries.

AI-generated description

Similar vizzes