PHP code example of jrumbut / eloquent-memoize
1. Go to this page and download the library: Download jrumbut/eloquent-memoize library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
jrumbut / eloquent-memoize example snippets
php
class MyModel extends MemoizingModel
{
protected static $memoized = ['slow_attribute'];
//Now only slow the first time it's accessed
public function getSlowAttribute($value)
{
sleep(3);
return ucwords($value);
}
}