2017-09-14 22:21:00 +03:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Module;
|
|
|
|
|
2019-11-16 10:21:14 +03:00
|
|
|
use App\Abstracts\Http\FormRequest;
|
2018-07-30 11:34:51 +03:00
|
|
|
use App\Traits\Modules as RemoteModules;
|
2018-04-25 17:39:32 +03:00
|
|
|
use Illuminate\Validation\Factory as ValidationFactory;
|
2017-09-14 22:21:00 +03:00
|
|
|
|
2019-11-16 10:21:14 +03:00
|
|
|
class Module extends FormRequest
|
2017-09-14 22:21:00 +03:00
|
|
|
{
|
2018-07-30 11:34:51 +03:00
|
|
|
use RemoteModules;
|
2018-04-25 16:56:01 +03:00
|
|
|
|
2018-04-25 17:39:32 +03:00
|
|
|
public function __construct(ValidationFactory $validation)
|
2018-04-25 16:56:01 +03:00
|
|
|
{
|
2018-04-25 17:39:32 +03:00
|
|
|
$validation->extend(
|
2018-04-25 16:56:01 +03:00
|
|
|
'check',
|
|
|
|
function ($attribute, $value, $parameters) {
|
|
|
|
return $this->checkToken($value);
|
|
|
|
},
|
2019-11-16 10:21:14 +03:00
|
|
|
trans('messages.error.invalid_apikey')
|
2018-04-25 16:56:01 +03:00
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2017-09-14 22:21:00 +03:00
|
|
|
/**
|
|
|
|
* Determine if the user is authorized to make this request.
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function authorize()
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the validation rules that apply to the request.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function rules()
|
|
|
|
{
|
|
|
|
return [
|
2019-11-16 10:21:14 +03:00
|
|
|
'api_key' => 'required|string|check',
|
2017-09-14 22:21:00 +03:00
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|