Closed ghost closed 3 years ago
Why not? The request can be accessed everywhere, for example via request()
. I haven't really used Vapor fields though, so I'm not sure how to handle this specific case.
Thanks @Tarpsvo it is working. I have to change some code as well.
VaporImage::make('Featured Backgroud Image', 'ft_number_backgroud_image')
->rules('bail', 'required', function($attribute, $value, $fail) use ($request) {
if (Storage::size(request()->input('vaporFile')['key']) > 1000) {
return $fail('The image should not have more than 1 KB');
}
}),
NovaServiceProvider.boot() method don't have access of request object.