<?php namespace App\Http\Requests\Link; use App\Http\Requests\Request; use Illuminate\Validation\Rule; use Illuminate\Database\Query\Builder; class LinkCountSaveRequest extends Request { /** * Determine if the user is authorized to make this request. * * @return bool */ public function authorize() { return true; } /** * Get the validation rules that apply to the request. * * @return array */ public function rules() { if (!$this->ajax()) { return []; } return [ 'link_id' => 'required', 'username' => 'required', 'password' => 'required', 'email' => 'nullable', 'url' => 'required', 'created_at' => 'nullable' // 'redundant_site_id' => 'required' ]; } public function attributes() { return [ 'link_id' => '外链类型', 'url' => '演示地址', 'username' => '用户名', 'password' => '密码', 'email' => '邮箱', // 'redundant_site_id' => '站点' ]; } }