<?php
namespace WpBookingHotelAdminWooPanel\app\controllers;
use WpBookingHotel\Factory;
use WpBookingHotel\Mvc\Controller\ControllerFormWooPanel;
use WpBookingHotel\Mvc\Model\Model;
use WpBookingHotel\Utilities\Utility;

defined('_WPBOOKINGHOTEL_EXEC') or die;
class PaymentController extends ControllerFormWooPanel
{
    public $view="payment";
    public $model = "payment";
    public function ajax_create_payment_by_payment_name()
    {

        $paymentModel = Model::getInstance('payment');
        $input = Factory::getInput();
        $data = $input->getData();
        $payment_name = isset($data['payment'])?$data['payment']:'';
        if(trim($payment_name) != '') {
            $payment = $paymentModel->create_payment_by_payment_name($payment_name);
            $this->redirect(Utility::getBackendWooPanelGoToLink($this->view.".form",array("id"=>$payment->id)));
            return $payment;
        }
    }
}