osb/app/Http/Requests/ServiceChangeRequest.php
Deon George ef0d4dc773
All checks were successful
Create Docker Image / Build Docker Image (x86_64) (push) Successful in 55s
Create Docker Image / Final Docker Image Manifest (push) Successful in 12s
Change ScopeServiceUserAuthorised to ScopeAccountUserAuthorised. Scope payments to AccountUserAuthorised, and added PaymentPolicy
2024-08-10 23:53:13 +10:00

41 lines
1021 B
PHP

<?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')
->AccountUserAuthorised();
}
/**
* 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.price' => 'nullable|numeric',
'broadband.start_at' => 'required|date', // @todo Check that it is not more than 1 billing cycle ago, and not future.
];
}
}