1$dt = new Carbon\Carbon();
2$before = $dt->subYears(13)->format('Y-m-d');
3
4$rules = [
5 ...
6 'dob' => 'required|date|before:' . $before
7];
8
9---------------
10
11Different Solution (Enhanced)
12
13use Carbon\Carbon;
14
15 $dt = new Carbon();
16 $before18Years = $dt->subYears(18)->format('Y-m-d');
17
18
19 'birthdate' => [
20 'date_format:' . config('panel.date_format'),
21 'required',
22 'before:'.$before18Years,
23 ],
24
25file panel.php
26
27<?php
28
29return [
30 'date_format' => 'Y-m-d',
31 'time_format' => 'H:i:s',
32 'primary_language' => 'en',
33];
34
35