1 | <?php |
||
7 | class Observer |
||
8 | { |
||
9 | /** |
||
10 | * Validation skipping flag. |
||
11 | * |
||
12 | * @var integer |
||
13 | */ |
||
14 | const SKIP_ONCE = 1; |
||
15 | |||
16 | /** |
||
17 | * Validation skipping flag. |
||
18 | * |
||
19 | * @var integer |
||
20 | */ |
||
21 | const SKIP_ALWAYS = 2; |
||
22 | |||
23 | /** |
||
24 | * Halt creating if model doesn't pass validation. |
||
25 | * |
||
26 | * @param \Sofa\Eloquence\Contracts\Validable $model |
||
27 | * @return void|false |
||
28 | */ |
||
29 | public function creating(Validable $model) |
||
35 | |||
36 | /** |
||
37 | * Updating event handler. |
||
38 | * |
||
39 | * @param \Sofa\Eloquence\Contracts\Validable $model |
||
40 | * @return void|false |
||
41 | */ |
||
42 | public function updating(Validable $model) |
||
48 | |||
49 | /** |
||
50 | * Halt updating if model doesn't pass validation. |
||
51 | * |
||
52 | * @param \Sofa\Eloquence\Contracts\Validable $model |
||
53 | * @return void|false |
||
54 | */ |
||
55 | protected function validateUpdate(Validable $model) |
||
70 | |||
71 | /** |
||
72 | * Enable validation for the model if skipped only once. |
||
73 | * |
||
74 | * @param \Sofa\Eloquence\Contracts\Validable $model |
||
75 | * @return void |
||
76 | */ |
||
77 | public function saved(Validable $model) |
||
83 | } |
||
84 |