34 lines
821 B
PHP
34 lines
821 B
PHP
<?php
|
|
|
|
namespace App\Http\Requests;
|
|
|
|
use App\Facades\Options;
|
|
use Illuminate\Auth\Access\AuthorizationException;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
class ApproveInviteRequest extends FormRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return !Options::getOption('enable_registrations');
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [];
|
|
}
|
|
|
|
protected function failedAuthorization()
|
|
{
|
|
throw new AuthorizationException(__('Sign ups are open; you can\'t modify invites until you close them.'));
|
|
}
|
|
}
|