| Conditions | 1 |
| Paths | 1 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 36 | public function log($description = '') |
||
| 37 | { |
||
| 38 | $payload = [ |
||
| 39 | 'user_id' => auth()->id(), |
||
| 40 | 'description' => $description, |
||
| 41 | 'request' => json_encode( |
||
| 42 | [ |
||
| 43 | 'url' => request()->url(), |
||
| 44 | 'method' => request()->method(), |
||
| 45 | 'query' => request()->fullUrl(), |
||
| 46 | 'secure' => request()->secure(), |
||
| 47 | 'client_ip' => request()->ip(), |
||
| 48 | 'payload' => request()->all(), |
||
| 49 | ] |
||
| 50 | ), |
||
| 51 | ]; |
||
| 52 | |||
| 53 | return $this->model->create($payload); |
||
| 54 | } |
||
| 55 | } |
||
| 56 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: