-
Notifications
You must be signed in to change notification settings - Fork 402
Description
| Q | A |
|---|---|
| Bug? | yes |
| New Feature? | no |
| Framework | Laravel |
| Framework version | 5.7.15 |
| Package version | 8.0.4 |
| PHP version | 7.2.5 |
Actual Behaviour
Currently, events fired via plain URLs without query strings are audited with a trailing question mark. A database entry may look like this:
http://laravel.test/posts/create?
Expected Behaviour
I would expect URLs without query strings to be represented cleanly.
Steps to Reproduce
In a fresh installation of Laravel and the Auditing package, with a simple Post model, hit the /post/create route and trigger a created event. This will generate an audit in the database with a trailing question mark in the URL field.
Possible Solutions
I believe this is due to an incorrect usage of Request::fullUrlWithQuery([]) here:
| return Request::fullUrlWithQuery([]); |
If I'm not mistaken, this method is intended to append additional query string parameters to the request URL. To simply retrieve the current full URL with all existing parameters and avoid the trailing question mark issue, the following could be used instead:
return Request::fullUrl();
Please let me know if there's something I'm missing here. Otherwise, I would love to see this changed. Also, my apologies for being repetitive while trying to format this to the issue template. Thanks!