<?php

namespace App\Admin\Actions\Course;

use Dcat\Admin\Form\AbstractTool;
use Dcat\Admin\Widgets\Modal;

class CourseField extends AbstractTool
{
    /**
     * @return string
     */
    protected $title = '添加场地';

    protected $model;

    public function __construct(string $model = null, $id = 0)
    {
        $this->model = $model;
        $this->title = '<a class="btn btn-sm btn-primary" style="color:#ffffff;margin-right:10px">'.$this->title.'</a>';
        $this->id = $id;
    }

    public function render()
    {
        $form = CourseFieldForm::make()->payload(['id' => $this->id]);
        return Modal::make()
            ->lg()
            ->title('')
            ->body($form)
            ->button($this->title);
    }

}
