• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
beta 2 - base_url() inconsistent in namespaces

#2
base_url() should be the same from any namespace. So that definitely sounds like a bug. PLease file a bug report for that!

The request and response classes are only automatically inserted as a property in controllers, so $this->response is only available in controller, not model.

In my opinion you shouldn't be messing with response or requests from within a model, but if you want to, you can always grab the current instance through the services:

Code:
$request = \Config\Services::request();
$response = service('response')

There's two ways to grab a service so I showed both for example, but either way would work with any service.
Support Development  • Practical CodeIgniter 3  • Vulcan - CLI Tools for CI4
Reply


Messages In This Thread
RE: beta 2 - base_url() inconsistent in namespaces - by kilishan - 04-12-2019, 12:00 PM

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2019 MyBB Group.