40 lines
897 B
PHP
40 lines
897 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Chaturmas;
|
|
|
|
use App\Models\Sant;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Http\Request;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
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(Request $request)
|
|
{
|
|
return [
|
|
'place' => 'required',
|
|
'chaturmas_date_id' => [
|
|
'required' , 'exists:chaturmas_dates,id',
|
|
'date_format:Y',
|
|
Rule::unique('chaturmas', 'chaturmas_date_id')
|
|
->where('sant_id', $request->route('sant')->id),
|
|
]
|
|
];
|
|
}
|
|
}
|