This repository was archived by the owner on Sep 13, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +23
-7
lines changed
Expand file tree Collapse file tree 3 files changed +23
-7
lines changed Original file line number Diff line number Diff line change 11# Changes History
22
3+ 1.0.6
4+ -----
5+ Resolve "Presence verifier has not been set." issue for ** exists** and ** in** rules
6+
371.0.5
48-----
5- Add ability to use custom declared validation rules
9+ Add ability to use custom declared validation rules
610
7111.0.4
812-----
9- Add 'sometimes' rule modifier
13+ Add 'sometimes' rule modifier
1014
11151.0.3
1216-----
Original file line number Diff line number Diff line change @@ -57,7 +57,8 @@ Add the FluentValidationServiceProvider in ``config/app.php``:
5757* Note:* You can omit service provider registration, but then you must call
5858* ->toString()* or * ->toArray()* on each builder.
5959If service provider is registered, manual casting of rule to string or array
60- is not necessary.
60+ is not necessary and default Laravel's * Illuminate\Validation\ValidationServiceProvider::class*
61+ can be removed from * 'providers'* array.
6162
6263
6364## Available classes
Original file line number Diff line number Diff line change 22
33namespace Saritasa \Laravel \Validation ;
44
5- use Illuminate \Support \ ServiceProvider ;
5+ use Illuminate \Validation \ ValidationServiceProvider ;
66use Illuminate \Contracts \Validation \Factory as IValidatorFactory ;
77
88/**
99 * Service provider substitutes default Laravel's validation factory
1010 * @see FluentValidatorFactory
1111 */
12- class FluentValidationServiceProvider extends ServiceProvider
12+ class FluentValidationServiceProvider extends ValidationServiceProvider
1313{
14- public function boot ()
14+ protected function registerValidationFactory ()
1515 {
16- $ this ->app ->bind (IValidatorFactory::class, FluentValidatorFactory::class);
16+ $ this ->app ->singleton ('validator ' , function ($ app ) {
17+ $ validator = new FluentValidatorFactory ($ app ['translator ' ], $ app );
18+
19+ // The validation presence verifier is responsible for determining the existence of
20+ // values in a given data collection which is typically a relational database or
21+ // other persistent data stores. It is used to check for "uniqueness" as well.
22+ if (isset ($ app ['db ' ], $ app ['validation.presence ' ])) {
23+ $ validator ->setPresenceVerifier ($ app ['validation.presence ' ]);
24+ }
25+
26+ return $ validator ;
27+ });
1728 }
1829}
You can’t perform that action at this time.
0 commit comments