@@ -1,7 +1,6 @@ |
||
| 1 | 1 | <?php namespace JackJoe\ActivityLog\Models; |
| 2 | 2 | |
| 3 | 3 | use Illuminate\Database\Eloquent\Model as Eloquent; |
| 4 | -use Illuminate\Support\Facades\Auth; |
|
| 5 | 4 | use Illuminate\Support\Facades\Request; |
| 6 | 5 | |
| 7 | 6 | class Activity extends Eloquent { |
@@ -50,22 +50,22 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | // set the defaults from config |
| 52 | 52 | $defaults = config('log.defaults'); |
| 53 | - if(!is_array($defaults)) { |
|
| 53 | + if (!is_array($defaults)) { |
|
| 54 | 54 | $defaults = []; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - if(is_object($data)) { |
|
| 57 | + if (is_object($data)) { |
|
| 58 | 58 | $data = (array) $data; |
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | // set the user ID |
| 62 | - if(config('log.auto_set_user_id') && !isset($data['userId'])) { |
|
| 62 | + if (config('log.auto_set_user_id') && !isset($data['userId'])) { |
|
| 63 | 63 | $user = call_user_func(config('log.auth_method')); |
| 64 | 64 | $data['userId'] = isset($user->id) ? $user->id : null; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | // set IP address |
| 68 | - if(!isset($data['ipAddress'])) { |
|
| 68 | + if (!isset($data['ipAddress'])) { |
|
| 69 | 69 | $data['ipAddress'] = Request::getClientIp(); |
| 70 | 70 | } |
| 71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | // set additional data and encode it as JSON if it is an array or an object |
| 78 | - if(isset($data['data']) && (is_array($data['data']) || is_object($data['data']))) { |
|
| 78 | + if (isset($data['data']) && (is_array($data['data']) || is_object($data['data']))) { |
|
| 79 | 79 | $data['data'] = json_encode($data['data']); |
| 80 | 80 | } |
| 81 | 81 | |