initial commit
This commit is contained in:
44
app/Http/Requests/CollectPaymentsRequest.php
Normal file
44
app/Http/Requests/CollectPaymentsRequest.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
|
||||
class CollectPaymentsRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public function messages(){
|
||||
return array(
|
||||
'product_name.required' => 'You need to specify the product name'
|
||||
);
|
||||
}
|
||||
public function responsenn(array $errors){
|
||||
// Always return JSON.
|
||||
return response()->json($errors, 422);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function rules()
|
||||
{
|
||||
return [
|
||||
'msisdn' => 'required|regex:/^(0)[89]\d{8}$/',
|
||||
'amount' => 'required',
|
||||
'product_name' => 'required',
|
||||
'refID' => 'required',
|
||||
'country' => 'required'
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user