-
Notifications
You must be signed in to change notification settings - Fork 0
/
RequestIp.php
39 lines (31 loc) · 868 Bytes
/
RequestIp.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<?php
declare(strict_types=1);
/*
* This file is part of the QuidPHP package <https://quidphp.com>
* Author: Pierre-Philippe Emond <emondpph@gmail.com>
* License: https://github.com/quidphp/core/blob/master/LICENSE
*/
namespace Quid\Core\Col;
use Quid\Core;
// requestIp
// class for a column which applies the current request ip as value on commit
class RequestIp extends Core\ColAlias
{
// config
protected static array $config = [
'general'=>true
];
// onCommit
// donne le ip de la requête courante lors d'un insert ou un update
final protected function onCommit($value,?Core\Cell $cell,array $row,array $option):?string
{
$return = null;
$boot = static::bootReady();
if(!empty($boot))
$return = $boot->request()->ip();
return $return;
}
}
// init
RequestIp::__init();
?>