<?php

namespace plugin\admin\app\controller;

use support\Request;
use support\Response;
use plugin\admin\app\model\Carouselad;
use plugin\admin\app\controller\Crud;
use support\exception\BusinessException;

/**
 * 广告轮播图 
 */
class CarouseladController extends Crud
{
    
    /**
     * @var Carouselad
     */
    protected $model = null;

    /**
     * 构造函数
     * @return void
     */
    public function __construct()
    {
        $this->model = new Carouselad;
    }
    
    /**
     * 浏览
     * @return Response
     */
    public function index(): Response
    {
        return view('carouselad/index');
    }

    /**
     * 插入
     * @param Request $request
     * @return Response
     * @throws BusinessException
     */
    public function insert(Request $request): Response
    {
        if ($request->method() === 'POST') {
            return parent::insert($request);
        }
        return view('carouselad/insert');
    }

    /**
     * 更新
     * @param Request $request
     * @return Response
     * @throws BusinessException
    */
    public function update(Request $request): Response
    {
        if ($request->method() === 'POST') {
            return parent::update($request);
        }
        return view('carouselad/update');
    }

}
