Laravel - Serialization of 'Closure' is not allowedLaravel: Permission Denied in Blade FileLaravel “Serialization of 'Closure' is not allowed”Laravel 5.2 Login of a userLaravel 5 loading phpBB 3.1Cannot access env variables in LaravelLaravel 5.6 - Using model functions in ModelFactoryGetting old cache view when there is PHP errors in controller - Laravel 5.6Nginx Laravel config returning 403Add Profile Information in MyAccountController [backpack-laravel]Method IlluminateAuthRequestGuard::attempt does not exist. when trying custom authentication via web route

Question about Shemot, locusts

How can I get a refund from a seller who only accepts Zelle?

Navigating a quick return to previous employer

Is there an idiom that means that you are in a very strong negotiation position in a negotiation?

Did significant numbers of Japanese officers escape prosecution during the Tokyo Trials?

Using too much dialogue?

Why is unzipped directory exactly 4.0K (much smaller than zipped file)?

Merge pdfs sequentially

Cisco 3750X Power Cable

Is this homebrew "Cactus Grenade" cantrip balanced?

Status of proof by contradiction and excluded middle throughout the history of mathematics?

Why do the i8080 I/O instructions take a byte-sized operand to determine the port?

Why is std::ssize() introduced in C++20?

Is superuser the same as root?

Why'd a rational buyer offer to buy with no conditions precedent?

Is a world with one country feeding everyone possible?

Was this scene in S8E06 added because of fan reactions to S8E04?

Visual Block Mode edit with sequential number

Who wrote “A writer only begins a book. A reader finishes it.”

These Two Cubes are The Only Ones That Are All Pure Prime..name them

What did Brienne write about Jaime?

To exponential digit growth and beyond!

Why did it take so long for Germany to allow electric scooters / e-rollers on the roads?

Quantum corrections to geometry



Laravel - Serialization of 'Closure' is not allowed


Laravel: Permission Denied in Blade FileLaravel “Serialization of 'Closure' is not allowed”Laravel 5.2 Login of a userLaravel 5 loading phpBB 3.1Cannot access env variables in LaravelLaravel 5.6 - Using model functions in ModelFactoryGetting old cache view when there is PHP errors in controller - Laravel 5.6Nginx Laravel config returning 403Add Profile Information in MyAccountController [backpack-laravel]Method IlluminateAuthRequestGuard::attempt does not exist. when trying custom authentication via web route






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








0















I am using Laravel 5.7 and... well, this error is happening because of a library that i am using right now: highideas/laravel-users-online in which this function:



public function setCache($minutes = 5)

return Cache::put($this->getCacheKey(), $this->getCacheContent(), $minutes);



Throws the next error:



Serialization of 'Closure' is not allowed


The two functions that it uses are:



public function getCacheContent()

if (!empty($cache = Cache::get($this->getCacheKey())))
return $cache;

$cachedAt = Carbon::now();
return [
'cachedAt' => $cachedAt,
'user' => $this,
];



And:



public function getCacheKey()

return sprintf('%s-%s', "UserOnline", $this->id);



Is there a way to fix this error?










share|improve this question






















  • What's in here $this->getCacheContent()? Cache::put('key', 'value', $min); requires second parameter to be string

    – senty
    Mar 23 at 22:09












  • The code of that function is in my question

    – Enrique Bermúdez
    Mar 23 at 22:10











  • The FileStore.php file says that the second parameter "value" is a mixed, not a string

    – Enrique Bermúdez
    Mar 23 at 22:12











  • Oh sorry, missed that. It's returning an array, however the required parameter should be string. You can try serialize($this->getCacheContent()) to convert array to string

    – senty
    Mar 23 at 22:12






  • 1





    Cache::put will already call serialize internally. I suspect issue is related to the user variable, which contains some data which cannot be automatically serialized.

    – levi
    Mar 23 at 22:50


















0















I am using Laravel 5.7 and... well, this error is happening because of a library that i am using right now: highideas/laravel-users-online in which this function:



public function setCache($minutes = 5)

return Cache::put($this->getCacheKey(), $this->getCacheContent(), $minutes);



Throws the next error:



Serialization of 'Closure' is not allowed


The two functions that it uses are:



public function getCacheContent()

if (!empty($cache = Cache::get($this->getCacheKey())))
return $cache;

$cachedAt = Carbon::now();
return [
'cachedAt' => $cachedAt,
'user' => $this,
];



And:



public function getCacheKey()

return sprintf('%s-%s', "UserOnline", $this->id);



Is there a way to fix this error?










share|improve this question






















  • What's in here $this->getCacheContent()? Cache::put('key', 'value', $min); requires second parameter to be string

    – senty
    Mar 23 at 22:09












  • The code of that function is in my question

    – Enrique Bermúdez
    Mar 23 at 22:10











  • The FileStore.php file says that the second parameter "value" is a mixed, not a string

    – Enrique Bermúdez
    Mar 23 at 22:12











  • Oh sorry, missed that. It's returning an array, however the required parameter should be string. You can try serialize($this->getCacheContent()) to convert array to string

    – senty
    Mar 23 at 22:12






  • 1





    Cache::put will already call serialize internally. I suspect issue is related to the user variable, which contains some data which cannot be automatically serialized.

    – levi
    Mar 23 at 22:50














0












0








0








I am using Laravel 5.7 and... well, this error is happening because of a library that i am using right now: highideas/laravel-users-online in which this function:



public function setCache($minutes = 5)

return Cache::put($this->getCacheKey(), $this->getCacheContent(), $minutes);



Throws the next error:



Serialization of 'Closure' is not allowed


The two functions that it uses are:



public function getCacheContent()

if (!empty($cache = Cache::get($this->getCacheKey())))
return $cache;

$cachedAt = Carbon::now();
return [
'cachedAt' => $cachedAt,
'user' => $this,
];



And:



public function getCacheKey()

return sprintf('%s-%s', "UserOnline", $this->id);



Is there a way to fix this error?










share|improve this question














I am using Laravel 5.7 and... well, this error is happening because of a library that i am using right now: highideas/laravel-users-online in which this function:



public function setCache($minutes = 5)

return Cache::put($this->getCacheKey(), $this->getCacheContent(), $minutes);



Throws the next error:



Serialization of 'Closure' is not allowed


The two functions that it uses are:



public function getCacheContent()

if (!empty($cache = Cache::get($this->getCacheKey())))
return $cache;

$cachedAt = Carbon::now();
return [
'cachedAt' => $cachedAt,
'user' => $this,
];



And:



public function getCacheKey()

return sprintf('%s-%s', "UserOnline", $this->id);



Is there a way to fix this error?







laravel






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 23 at 22:03









Enrique BermúdezEnrique Bermúdez

471320




471320












  • What's in here $this->getCacheContent()? Cache::put('key', 'value', $min); requires second parameter to be string

    – senty
    Mar 23 at 22:09












  • The code of that function is in my question

    – Enrique Bermúdez
    Mar 23 at 22:10











  • The FileStore.php file says that the second parameter "value" is a mixed, not a string

    – Enrique Bermúdez
    Mar 23 at 22:12











  • Oh sorry, missed that. It's returning an array, however the required parameter should be string. You can try serialize($this->getCacheContent()) to convert array to string

    – senty
    Mar 23 at 22:12






  • 1





    Cache::put will already call serialize internally. I suspect issue is related to the user variable, which contains some data which cannot be automatically serialized.

    – levi
    Mar 23 at 22:50


















  • What's in here $this->getCacheContent()? Cache::put('key', 'value', $min); requires second parameter to be string

    – senty
    Mar 23 at 22:09












  • The code of that function is in my question

    – Enrique Bermúdez
    Mar 23 at 22:10











  • The FileStore.php file says that the second parameter "value" is a mixed, not a string

    – Enrique Bermúdez
    Mar 23 at 22:12











  • Oh sorry, missed that. It's returning an array, however the required parameter should be string. You can try serialize($this->getCacheContent()) to convert array to string

    – senty
    Mar 23 at 22:12






  • 1





    Cache::put will already call serialize internally. I suspect issue is related to the user variable, which contains some data which cannot be automatically serialized.

    – levi
    Mar 23 at 22:50

















What's in here $this->getCacheContent()? Cache::put('key', 'value', $min); requires second parameter to be string

– senty
Mar 23 at 22:09






What's in here $this->getCacheContent()? Cache::put('key', 'value', $min); requires second parameter to be string

– senty
Mar 23 at 22:09














The code of that function is in my question

– Enrique Bermúdez
Mar 23 at 22:10





The code of that function is in my question

– Enrique Bermúdez
Mar 23 at 22:10













The FileStore.php file says that the second parameter "value" is a mixed, not a string

– Enrique Bermúdez
Mar 23 at 22:12





The FileStore.php file says that the second parameter "value" is a mixed, not a string

– Enrique Bermúdez
Mar 23 at 22:12













Oh sorry, missed that. It's returning an array, however the required parameter should be string. You can try serialize($this->getCacheContent()) to convert array to string

– senty
Mar 23 at 22:12





Oh sorry, missed that. It's returning an array, however the required parameter should be string. You can try serialize($this->getCacheContent()) to convert array to string

– senty
Mar 23 at 22:12




1




1





Cache::put will already call serialize internally. I suspect issue is related to the user variable, which contains some data which cannot be automatically serialized.

– levi
Mar 23 at 22:50






Cache::put will already call serialize internally. I suspect issue is related to the user variable, which contains some data which cannot be automatically serialized.

– levi
Mar 23 at 22:50













0






active

oldest

votes












Your Answer






StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");

StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);

else
createEditor();

);

function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













draft saved

draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55318809%2flaravel-serialization-of-closure-is-not-allowed%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes















draft saved

draft discarded
















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid


  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55318809%2flaravel-serialization-of-closure-is-not-allowed%23new-answer', 'question_page');

);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript