1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-11 13:42:49 +01:00
invoiceninja/app/Http/Requests/ClientPortal/Subscriptions/ShowPlanSwitchRequest.php

46 lines
1.1 KiB
PHP
Raw Normal View History

2021-04-07 18:08:26 +02:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
*
* @license https://www.elastic.co/licensing/elastic-license
*/
2021-04-07 18:08:26 +02:00
namespace App\Http\Requests\ClientPortal\Subscriptions;
use App\Exceptions\Ninja\ClientPortalAuthorizationException;
2021-04-07 18:08:26 +02:00
use Illuminate\Foundation\Http\FormRequest;
class ShowPlanSwitchRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return (bool) $this->recurring_invoice->subscription->allow_plan_changes;
2021-04-07 18:08:26 +02:00
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
//
];
}
protected function failedAuthorization()
{
throw new ClientPortalAuthorizationException('Unable to change plans due to a restriction on this product.', 400);
}
2021-04-07 18:08:26 +02:00
}