ldc-web/app/Http/Requests/Webhooks/GitlabRequest.php
2022-04-27 17:29:10 +02:00

30 lines
643 B
PHP

<?php
namespace App\Http\Requests\Webhooks;
use Illuminate\Foundation\Http\FormRequest;
class GitlabRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return $this->header('X-Gitlab-Token') !== null && $this->header('X-Gitlab-Token') === config('webhooks.gitlab.token');
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'event_type' => 'required|in:merge_request'
];
}
}