Change to method used for retrieving settings data from Settings::instance() to Settings::get()
Seems simpler and more reliable.
This commit is contained in:
parent
1c9de8f4b5
commit
e4d86628aa
@ -1,15 +1,13 @@
|
|||||||
<?php namespace JasonWilliams\CalgaryConditions\Components;
|
<?php namespace JasonWilliams\CalgaryConditions\Components;
|
||||||
|
|
||||||
use Cms\Classes\ComponentBase;
|
use Cms\Classes\ComponentBase;
|
||||||
|
use ApplicationException;
|
||||||
use October\Rain\Network\Http;
|
use October\Rain\Network\Http;
|
||||||
use JasonWilliams\CalgaryConditions\Models\Settings;
|
use JasonWilliams\CalgaryConditions\Models\Settings;
|
||||||
use Cache;
|
use Cache;
|
||||||
use ApplicationException;
|
|
||||||
|
|
||||||
class CurrentInfo extends ComponentBase
|
class CurrentInfo extends ComponentBase
|
||||||
{
|
{
|
||||||
//public $fields;
|
|
||||||
|
|
||||||
public function componentDetails()
|
public function componentDetails()
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
@ -28,10 +26,8 @@ class CurrentInfo extends ComponentBase
|
|||||||
|
|
||||||
public function onUpdateRequested()
|
public function onUpdateRequested()
|
||||||
{
|
{
|
||||||
$settings = Settings::instance();
|
|
||||||
|
|
||||||
$response = Cache::remember('weatherdata', 60, function() {
|
$response = Cache::remember('weatherdata', 60, function() {
|
||||||
return json_decode(Http::get('http://api.weatherstack.com/current?access_key='.$settings->weatherstack_api_key.'&query=Calgary'));
|
return json_decode(Http::get('http://api.weatherstack.com/current?access_key='.Settings::get('weatherstack_api_key').'&query=Calgary'));
|
||||||
});
|
});
|
||||||
|
|
||||||
date_default_timezone_set('America/Edmonton');
|
date_default_timezone_set('America/Edmonton');
|
||||||
|
Loading…
Reference in New Issue
Block a user