#php #laravel #validation
#php #laravel #проверка
Вопрос:
Я получил возврат проверки false, когда я добавил некоторые поля в запрос (жестко запрограммированный).
Для получения дополнительной информации вы можете просмотреть файл ниже (CreatePackageServiceRequest):
<?php
namespace AppContainersPackageUIAPIRequests;
use AppShipParentsRequestsRequest;
use Auth;
/**
* Class CreatePackageServiceRequest.
*/
class CreatePackageServiceRequest extends Request
{
/**
* The assigned Transporter for this Request
*
* @var string
*/
// protected $transporter = AppShipTransportersDataTransporter::class;
/**
* Define which Roles and/or Permissions has access to this request.
*
* @var array
*/
protected $access = [
'permissions' => '',
'roles' => '',
];
/**
* Id's that needs decoding before applying the validation rules.
*
* @var array
*/
protected $decode = [
// 'id',
];
/**
* Defining the URL parameters (e.g, `/user/{id}`) allows applying
* validation rules on them and allows accessing them like request data.
*
* @var array
*/
protected $urlParameters = [
// 'id',
];
/**
* @return array
*/
public function rules()
{
$this->request->set('user_id', Auth::user()->id);
$this->request->set('vendor_id', Auth::user()->ownedVendor->id);
// dd($this->all()); // we've got all the input we want here
return [
'name' => 'required|max:255',
'has_limited_number_of_event' => 'required',
'min_length' => 'required|numeric',
'max_length' => 'required|numeric|min:'.($this->get('min_length') 1),
'max_booking' => 'required',
'message_on_booking_full' => 'required',
'allow_choose_host' => 'required',
'allow_skip' => 'required',
'host_name' => 'required',
'allow_extra_booking' => 'required',
'message_no_host_available' => 'required',
'has_photobooth_operator' => 'required',
'require_photobooth_background' => 'required',
'require_customization' => 'required',
'customization_title' => 'required',
'customization_label' => 'required',
'user_id' => 'required',
'vendor_id' => 'required',
// '{user-input}' => 'required|max:255',
];
}
/**
* @return bool
*/
public function authorize()
{
return $this->check([
'hasAccess',
]);
}
}
Когда я запускаю dd($this->all())
, все входные данные, которые я хочу, добавляются туда. Но результат этой роли / проверки показывает, что требуются два дополнительных поля.
Вот ответ на проверку, вы можете увидеть user_id и vendor_id ниже.
{
"status": "error",
"code": 0,
"message": "The given data was invalid.",
"errors": {
"name": [
"The name field is required."
],
"has_limited_number_of_event": [
"The has limited number of event field is required."
],
"max_length": [
"The max length must be at least 5."
],
"max_booking": [
"The max booking field is required."
],
"message_on_booking_full": [
"The message on booking full field is required."
],
"allow_choose_host": [
"The allow choose host field is required."
],
"allow_skip": [
"The allow skip field is required."
],
"host_name": [
"The host name field is required."
],
"allow_extra_booking": [
"The allow extra booking field is required."
],
"message_no_host_available": [
"The message no host available field is required."
],
"has_photobooth_operator": [
"The has photobooth operator field is required."
],
"require_photobooth_background": [
"The require photobooth background field is required."
],
"require_customization": [
"The require customization field is required."
],
"customization_title": [
"The customization title field is required."
],
"customization_label": [
"The customization label field is required."
],
"user_id": [
"The user id field is required."
],
"vendor_id": [
"The vendor id field is required."
]
},
"status_code": 422,
"exception": "Illuminate\Validation\ValidationException",
"file": "/iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php",
"line": 117,
"trace": "Illuminate\Validation\ValidationException: The given data was invalid. in /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Foundation/Http/FormRequest.php:117nStack trace:n#0 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Validation/ValidatesWhenResolvedTrait.php(24): Illuminate\Foundation\Http\FormRequest->failedValidation(Object(Illuminate\Validation\Validator))n#1 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Foundation/Providers/FormRequestServiceProvider.php(31): Illuminate\Foundation\Http\FormRequest->validateResolved()n#2 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Container/Container.php(1057): Illuminate\Foundation\Providers\FormRequestServiceProvider->Illuminate\Foundation\Providers\{closure}(Object(App\Containers\Package\UI\API\Requests\CreatePackageServiceRequest), Object(Illuminate\Foundation\Application))n#3 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Container/Container.php(1021): Illuminate\Container\Container->fireCallbackArray(Object(App\Containers\Package\UI\API\Requests\CreatePackageServiceRequest), Array)n#4 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Container/Container.php(1006): Illuminate\Container\Container->fireAfterResolvingCallbacks('App\\Containers\\...', Object(App\Containers\Package\UI\API\Requests\CreatePackageServiceRequest))n#5 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Container/Container.php(665): Illuminate\Container\Container->fireResolvingCallbacks('App\\Containers\\...', Object(App\Containers\Package\UI\API\Requests\CreatePackageServiceRequest))n#6 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Container/Container.php(601): Illuminate\Container\Container->resolve('App\\Containers\\...', Array)n#7 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(740): Illuminate\Container\Container->make('App\\Containers\\...', Array)n#8 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php(79): Illuminate\Foundation\Application->make('App\\Containers\\...')n#9 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php(46): Illuminate\Routing\ControllerDispatcher->transformDependency(Object(ReflectionParameter), Array)n#10 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/RouteDependencyResolverTrait.php(27): Illuminate\Routing\ControllerDispatcher->resolveMethodDependencies(Array, Object(ReflectionMethod))n#11 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(41): Illuminate\Routing\ControllerDispatcher->resolveClassMethodDependencies(Array, Object(App\Containers\Package\UI\API\Controllers\Controller), 'createPackageSe...')n#12 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Route.php(212): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(App\Containers\Package\UI\API\Controllers\Controller), 'createPackageSe...')n#13 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Route.php(169): Illuminate\Routing\Route->runController()n#14 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(659): Illuminate\Routing\Route->run()n#15 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#16 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Auth/Middleware/Authenticate.php(43): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#17 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Auth\Middleware\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure), 'api')n#18 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))n#19 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php(57): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#20 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Routing\Middleware\ThrottleRequests->handle(Object(Illuminate\Http\Request), Object(Closure), 30, '1')n#21 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))n#22 /iProject/Development/scotch.io/public/blackforest/app/Containers/Localization/Middlewares/LocalizationMiddleware.php(37): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#23 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): App\Containers\Localization\Middlewares\LocalizationMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))n#24 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))n#25 /iProject/Development/scotch.io/public/blackforest/app/Ship/Middlewares/Http/ProfilerMiddleware.php(26): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#26 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): App\Ship\Middlewares\Http\ProfilerMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))n#27 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))n#28 /iProject/Development/scotch.io/public/blackforest/app/Ship/Middlewares/Http/ProcessETagHeadersMiddleware.php(50): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#29 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): App\Ship\Middlewares\Http\ProcessETagHeadersMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))n#30 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))n#31 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Middleware/SubstituteBindings.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#32 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Routing\Middleware\SubstituteBindings->handle(Object(Illuminate\Http\Request), Object(Closure))n#33 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))n#34 /iProject/Development/scotch.io/public/blackforest/app/Ship/Middlewares/Http/ValidateJsonContent.php(41): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#35 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): App\Ship\Middlewares\Http\ValidateJsonContent->handle(Object(Illuminate\Http\Request), Object(Closure))n#36 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))n#37 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#38 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(661): Illuminate\Pipeline\Pipeline->then(Object(Closure))n#39 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(636): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))n#40 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(602): Illuminate\Routing\Router->runRoute(Object(Illuminate\Http\Request), Object(Illuminate\Routing\Route))n#41 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Router.php(591): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))n#42 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))n#43 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))n#44 /iProject/Development/scotch.io/public/blackforest/vendor/barryvdh/laravel-debugbar/src/Middleware/InjectDebugbar.php(58): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#45 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Barryvdh\Debugbar\Middleware\InjectDebugbar->handle(Object(Illuminate\Http\Request), Object(Closure))n#46 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))n#47 /iProject/Development/scotch.io/public/blackforest/vendor/barryvdh/laravel-cors/src/HandleCors.php(36): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#48 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Barryvdh\Cors\HandleCors->handle(Object(Illuminate\Http\Request), Object(Closure))n#49 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))n#50 /iProject/Development/scotch.io/public/blackforest/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#51 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Fideloper\Proxy\TrustProxies->handle(Object(Illuminate\Http\Request), Object(Closure))n#52 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))n#53 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#54 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))n#55 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))n#56 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(30): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#57 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Foundation\Http\Middleware\TransformsRequest->handle(Object(Illuminate\Http\Request), Object(Closure))n#58 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))n#59 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#60 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Foundation\Http\Middleware\ValidatePostSize->handle(Object(Illuminate\Http\Request), Object(Closure))n#61 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))n#62 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(46): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#63 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))n#64 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))n#65 /iProject/Development/scotch.io/public/blackforest/app/Containers/Debugger/Middlewares/RequestsMonitorMiddleware.php(27): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#66 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(149): App\Containers\Debugger\Middlewares\RequestsMonitorMiddleware->handle(Object(Illuminate\Http\Request), Object(Closure))n#67 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))n#68 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): Illuminate\Routing\Pipeline->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))n#69 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\Pipeline\Pipeline->then(Object(Closure))n#70 /iProject/Development/scotch.io/public/blackforest/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))n#71 /iProject/Development/scotch.io/public/blackforest/public/index.php(53): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))n#72 /Users/macbookpro/.composer/vendor/laravel/valet/server.php(151): require('/iProject/Devel...')n#73 {main}"
}
Комментарии:
1. Не могли бы вы выразиться более ясно? Из-за добавления каких 2 полей проверка запроса завершается неудачей?
2. спасибо за комментарий @vivek_23, я добавил ответ на эту проверку, вы можете увидеть user_id и vendor_id, они все еще должны быть обязательными, даже если я добавляю их во входной запрос. проблема в том, что проверка завершается неудачей (ввод по-прежнему требуется), даже если я установил ввод.
3. Они все еще должны быть обязательными, потому что они присутствуют в возвращаемом массиве
rules()
метода.
Ответ №1:
основываясь на ответе vivek_23 и после серфинга в Интернете, я нашел решение для этой проблемы.
мы не можем добавить дополнительные поля в метод rules, нам нужно добавить их в конструктор.
вот мой окончательный код.
<?php
namespace AppContainersPackageUIAPIRequests;
use AppShipParentsRequestsRequest;
use Auth;
/**
* Class CreatePackageServiceRequest.
*/
class CreatePackageServiceRequest extends Request
{
/**
* The assigned Transporter for this Request
*
* @var string
*/
// protected $transporter = AppShipTransportersDataTransporter::class;
/**
* Define which Roles and/or Permissions has access to this request.
*
* @var array
*/
protected $access = [
'permissions' => '',
'roles' => '',
];
/**
* Id's that needs decoding before applying the validation rules.
*
* @var array
*/
protected $decode = [
// 'id',
];
/**
* Defining the URL parameters (e.g, `/user/{id}`) allows applying
* validation rules on them and allows accessing them like request data.
*
* @var array
*/
protected $urlParameters = [
// 'id',
];
public function __construct(IlluminateHttpRequest $request)
{
$request->request->add([
'user_id' => Auth::user()->id,
'vendor_id' => Auth::user()->ownedVendor->id
]);
}
/**
* @return array
*/
public function rules()
{
// $this->merge([
// 'user_id' => Auth::user()->id,
// 'vendor_id' => Auth::user()->ownedVendor->id
// ]);
// dd($this->all());
return [
'name' => 'required|max:255',
'has_limited_number_of_event' => 'required',
'min_length' => 'required|numeric',
'max_length' => 'required|numeric|min:'.($this->get('min_length') 1),
'max_booking' => 'required',
'message_on_booking_full' => 'required',
'allow_choose_host' => 'required',
'allow_skip' => 'required',
'host_name' => 'required',
'allow_extra_booking' => 'required',
'message_no_host_available' => 'required',
'has_photobooth_operator' => 'required',
'require_photobooth_background' => 'required',
'require_customization' => 'required',
'customization_title' => 'required',
'customization_label' => 'required',
'user_id' => 'required',
'vendor_id' => 'required',
// '{user-input}' => 'required|max:255',
];
}
/**
* @return bool
*/
public function authorize()
{
return $this->check([
'hasAccess',
]);
}
}
Спасибо.