跳至主內容區

XOOPS輕鬆架

:::

主內容區域

選擇後會自動跳轉頁面

2-10 /app/Http/Requests/TopicRequest.php

<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class TopicRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return $this->user()->can('建立測驗');
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'topic' => 'required|max:191',
            'opt1'  => 'required|max:191',
            'opt2'  => 'required|max:191',
            'ans'   => 'required',
        ];
    }

    public function messages()
    {
        return [
            'required' => '「:attribute」為必填欄位',
            'max'      => '「:attribute」最多只能 :max 個字',
        ];
    }

    public function attributes()
    {
        return [
            'topic' => '題目',
            'opt1'  => '選項1',
            'opt2'  => '選項2',
            'ans'   => '答案',
        ];
    }
}

 

選擇後會自動跳轉頁面

:::

左邊區域內容

書籍目錄

展開 | 闔起

快速登入


右邊區域內容

請掃此 QR Code 可連至此頁面

計數器

今天: 1554155415541554
昨天: 2635263526352635
總計: 9516973951697395169739516973951697395169739516973

頁尾區域