Ad
Error Passing Values From Function To A Controller As An Object
I have the following code:
$storedToken = getStoredToken();
/**
* Verify if the stored token has expired.
*/
if ($storedToken->hasExpired()) {
/**
* If the stored token has expired, then you request a new one.
*/
$newToken = $provider->getAccessToken('refresh_token', [
'refresh_token' => $storedToken->getRefreshToken()
In my db I have the following fields:
- token
- refreshtoken
- expires
I tried:
public function StoredToken(){
$user = Auth::user(); //data is on users table.
return $refreshtoken = $user->melirefreshtoken; //eg.
}
But with no success. I cannot find the way to create a function to create an object passing all the information.
Right now I received error:
Call to undefined function App\Http\Controllers\getStoredToken()
any help appreciated.
Ad
Answer
The root of the problem seems to be this line:
$storedToken = getStoredToken();
// ^^^^^^^^^^^^^^^^^
If you are trying to call a function from another function (from the same class).. add this:
$storedToken = $this->getStoredToken();
// ^^^^^^^
Ad
source: stackoverflow.com
Related Questions
- → "failed to open stream" error when executing "migrate:make"
- → October CMS Plugin Routes.php not registering
- → OctoberCMS Migrate Table
- → OctoberCMS Rain User plugin not working or redirecting
- → October CMS Custom Mail Layout
- → October CMS - How to correctly route
- → October CMS create a multi select Form field
- → October CMS - Conditionally Load a Different Page
- → How to disable assets combining on development in OctoberCMS
- → October CMS - Radio Button Ajax Click Twice in a Row Causes Content to disappear
- → OctoberCms component: How to display all ID(items) instead of sorting only one ID?
- → In OctoberCMS how do you find the hint path?
- → How to register middlewares in OctoberCMS plugin?
Ad