Extending UserAgent class |
Hello jacobs-kmi,
Here is what you need to do / can do. 1) Create a file in located at /app/Libraries/MyUserAgent.php with the following code: Code: <?php 2) Override the service(s) that call UserAgent, such that they use your class instead. To do this, open /app/Config/Services.php, and add this method, which was copied and modified from the system-level config: PHP Code: // This was copied from /vendor/codeigniter4/framework/system/Config/Services.php Now, when you call $this->request->getUserAgent(), you'll receive an instance of your custom class. Fuiyooooooh! |
Messages In This Thread |
Extending UserAgent class - by jacobs-kmi - 03-08-2022, 07:53 AM
RE: Extending UserAgent class - by Bennycopter - 03-08-2022, 10:50 AM
RE: Extending UserAgent class - by kenjis - 03-08-2022, 05:09 PM
RE: Extending UserAgent class - by Bennycopter - 03-10-2022, 08:19 AM
RE: Extending UserAgent class - by jacobs-kmi - 03-21-2022, 01:16 PM
|