2022-06-12 08:32:54 +00:00
|
|
|
<?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()
|
|
|
|
{
|
2024-08-10 13:53:13 +00:00
|
|
|
return $this
|
|
|
|
->route('o')
|
|
|
|
->AccountUserAuthorised();
|
2022-06-12 08:32:54 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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',
|
2023-05-03 08:09:29 +00:00
|
|
|
'broadband.price' => 'nullable|numeric',
|
2022-06-12 08:32:54 +00:00
|
|
|
'broadband.start_at' => 'required|date', // @todo Check that it is not more than 1 billing cycle ago, and not future.
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|