46 lines
948 B
PHP
46 lines
948 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Api\Chaturmas;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class StoreChaturmasRequest extends FormRequest
|
|
{
|
|
/**
|
|
* 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()
|
|
{
|
|
return [
|
|
'sant_id' => 'exists:sants,id',
|
|
'sagh_id' => 'exists:sanghs,id',
|
|
'place' => 'nullable',
|
|
'year' => 'required|exists:chaturmas_dates,id|date_format:Y',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function message()
|
|
{
|
|
return [
|
|
'year.exists' => 'Chaturmas already exist for selected year.',
|
|
];
|
|
}
|
|
}
|