46 lines
944 B
PHP
Raw Normal View History

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;
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
{
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
];
}
}