mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-14 07:02:34 +01:00
46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?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
|
|
*/
|
|
|
|
namespace App\Http\Requests\ClientPortal\Subscriptions;
|
|
|
|
use App\Exceptions\Ninja\ClientPortalAuthorizationException;
|
|
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;
|
|
}
|
|
|
|
/**
|
|
* 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);
|
|
}
|
|
}
|