87 lines
2.7 KiB
PHP
87 lines
2.7 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class UpdateBooking 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 [
|
|
// Booking information
|
|
'booking.date' => 'required',
|
|
'booking.reference' => 'required',
|
|
'booking.person_or_company' => 'required',
|
|
|
|
// Sub-booking informations
|
|
'sub_booking.*.reference' =>
|
|
'required_with:'
|
|
. 'sub_booking.*.amount,'
|
|
. 'sub_booking.*.account_type_id,'
|
|
. 'sub_booking.*.person_target_id,'
|
|
. 'sub_booking.*.project_id',
|
|
'sub_booking.*.amount' =>
|
|
'required_with:'
|
|
. 'sub_booking.*.reference,'
|
|
. 'sub_booking.*.account_type_id,'
|
|
. 'sub_booking.*.person_target_id,'
|
|
. 'sub_booking.*.project_id'
|
|
. '|nullable'
|
|
. '|numeric'
|
|
. '|min:0',
|
|
'sub_booking.*.account_type_id' =>
|
|
'required_with:'
|
|
. 'sub_booking.*.reference,'
|
|
. 'sub_booking.*.amount,'
|
|
. 'sub_booking.*.person_target_id,'
|
|
. 'sub_booking.*.project_id'
|
|
];
|
|
}
|
|
|
|
public function messages()
|
|
{
|
|
return [
|
|
// Booking
|
|
'booking.date.required' =>
|
|
'Die Buchung muss ein Datum haben.',
|
|
|
|
'booking.reference.required' =>
|
|
'Die Buchung muss einen Buchungstext haben.',
|
|
|
|
'booking.person_or_company' =>
|
|
'Der Buchung muss eine Person oder Firma zugeordnet werden.',
|
|
|
|
// Sub-bookings
|
|
'sub_booking.*.reference.required_with' =>
|
|
'Die Teilbuchung muss einen Buchungstext haben.',
|
|
|
|
'sub_booking.*.amount.required_with' =>
|
|
'Die Teilbuchung muss einen Betrag haben.',
|
|
'sub_booking.*.amount.numeric' =>
|
|
'Der Betrag muss eine Zahl sein.',
|
|
'sub_booking.*.amount.min' =>
|
|
'Der Betrag darf kein Vorzeichen haben. Das Vorzeichen Der
|
|
Teilbuchung wird durch das zugeordnete Konto bestimmt.',
|
|
|
|
'sub_booking.*.account_type_id.required_with' =>
|
|
'Der Teilbuchung muss ein Konto zugewiesen werden.'
|
|
];
|
|
}
|
|
}
|