Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- namespace App\Providers;
- use Illuminate\Support\ServiceProvider;
- use Illuminate\Support\Facades\Validator;
- class AppServiceProvider extends ServiceProvider
- {
- /**
- * Bootstrap any application services.
- *
- * @return void
- */
- public function boot()
- {
- // Custom validation for alpha and spaces
- // Then insert 'alpha_spaces' => 'The :attribute may only contain letters and spaces.' to validation.php file,
- Validator::extend('alpha_spaces', function ($attribute, $value) {
- // This will only accept alpha and spaces.
- // If you want to accept hyphens use: /^[\pL\s-]+$/u.
- return preg_match('/^[\pL\s]+$/u', $value);
- });
- }
- public function register()
- {
- //
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement