mirror of
				https://github.com/crater-invoice/crater.git
				synced 2025-10-28 12:11:08 -04:00 
			
		
		
		
	
		
			
				
	
	
		
			39 lines
		
	
	
		
			857 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			857 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| namespace Crater\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|digits_between:1,20',
 | |
|         ];
 | |
| 
 | |
|         if ($this->getMethod() == 'PUT') {
 | |
|             $rules['payment_number'] = $rules['payment_number'].','.$this->route('payment');
 | |
|         }
 | |
| 
 | |
|         return $rules;
 | |
|     }
 | |
| }
 |