Enabled changing broadband services and adjusting invoices
This commit is contained in:
38
app/Http/Requests/ServiceChangeRequest.php
Normal file
38
app/Http/Requests/ServiceChangeRequest.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Requests;
|
||||
|
||||
use Illuminate\Foundation\Http\FormRequest;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
|
||||
class ServiceChangeRequest extends FormRequest
|
||||
{
|
||||
/**
|
||||
* Determine if the user is authorized to make this request.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function authorize()
|
||||
{
|
||||
return $this->route('o')->serviceUserAuthorised(Auth::user());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the validation rules that apply to the request.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
* @todo This is specific to broadband - this needs to be more generic.
|
||||
*/
|
||||
public function rules(Request $request)
|
||||
{
|
||||
if (! $request->isMethod('post'))
|
||||
return [];
|
||||
|
||||
return [
|
||||
'broadband.product_id' => 'required|exists:products,id',
|
||||
'broadband.change_fee' => 'nullable|numeric',
|
||||
'broadband.start_at' => 'required|date', // @todo Check that it is not more than 1 billing cycle ago, and not future.
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user