add changes to create ticket
This commit is contained in:
@@ -8,6 +8,9 @@ use backend\models\TicketSearch;
|
||||
use yii\web\Controller;
|
||||
use yii\web\NotFoundHttpException;
|
||||
use yii\filters\VerbFilter;
|
||||
use common\models\Discount;
|
||||
use common\models\TicketType;
|
||||
use common\models\Account;
|
||||
|
||||
/**
|
||||
* TicketController implements the CRUD actions for Ticket model.
|
||||
@@ -61,12 +64,20 @@ class TicketController extends Controller
|
||||
public function actionCreate()
|
||||
{
|
||||
$model = new Ticket();
|
||||
|
||||
$discounts = Discount::read();
|
||||
$ticketTypes = TicketType::read();
|
||||
$accounts = Account::readAccounts();
|
||||
|
||||
|
||||
if ($model->load(Yii::$app->request->post()) && $model->save()) {
|
||||
return $this->redirect(['view', 'id' => $model->id_ticket]);
|
||||
} else {
|
||||
return $this->render('create', [
|
||||
'model' => $model,
|
||||
'discounts' => $discounts,
|
||||
'ticketTypes' => $ticketTypes,
|
||||
'accounts' => $accounts,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user