2018-05-10 01:45:24 +08:00
|
|
|
<?php
|
|
|
|
|
2019-07-16 03:44:31 +08:00
|
|
|
namespace App\Contracts;
|
2018-05-10 01:45:24 +08:00
|
|
|
|
2020-05-04 06:23:46 +08:00
|
|
|
use Illuminate\Validation\Rule;
|
|
|
|
|
2018-05-10 01:45:24 +08:00
|
|
|
class FormRequest extends \Illuminate\Foundation\Http\FormRequest
|
|
|
|
{
|
|
|
|
/**
|
2020-03-29 01:03:52 +08:00
|
|
|
* Authorized by default
|
|
|
|
*
|
2018-05-10 01:45:24 +08:00
|
|
|
* @return bool
|
|
|
|
*/
|
2020-03-29 01:03:52 +08:00
|
|
|
public function authorize(): bool
|
2018-05-10 01:45:24 +08:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
2020-03-29 01:03:52 +08:00
|
|
|
public function rules(): array
|
2018-05-10 01:45:24 +08:00
|
|
|
{
|
|
|
|
return [];
|
|
|
|
}
|
2020-05-04 06:23:46 +08:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Set a given column as being unique
|
|
|
|
*
|
|
|
|
* @param $table
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function unique($table)
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
Rule::unique($table)->ignore($this->id, 'id'),
|
|
|
|
];
|
|
|
|
}
|
2018-05-10 01:45:24 +08:00
|
|
|
}
|