mirror of
https://github.com/crater-invoice/crater.git
synced 2025-10-27 03:31:09 -04:00
39 lines
840 B
PHP
39 lines
840 B
PHP
<?php
|
|
namespace Laraspace\Http\Requests;
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class PaymentRequest 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()
|
|
{
|
|
$rules = [
|
|
'payment_date' => 'required',
|
|
'payment_number' => 'required|unique:payments,payment_number',
|
|
'user_id' => 'required',
|
|
'amount' => 'required',
|
|
];
|
|
|
|
if ($this->getMethod() == 'PUT') {
|
|
$rules['payment_number'] = $rules['payment_number'].','.$this->route('payment');
|
|
}
|
|
|
|
return $rules;
|
|
}
|
|
}
|