src/Models/Cacheable.php
public static function tableToArray()
    {
        $me        = new static();
        $cache_key = $me->cacheKey();

        // Return the array from the cache if it is present.
        if (Cache::has($cache_key)) {
            return (array) Cache::get($cache_key);
        }

        // Otherwise put the results into the cache and return them.
        $results = [];

        $query = static::all();

        // If the current model uses softDeletes then fix the
        // query to exclude those objects.
        foreach (class_uses(__CLASS__) as $traitName) {
            if ($traitName == 'SoftDeletes') {
                $query = static::whereNull('deleted_at')->get();
                break;
            }
        }

        /** @var Cacheable $row */
        foreach ($query as $row) {
            $results[$row->getIndexKey()] = $row->toFluent();
        }
        Cache::put($cache_key, $results, 60);
        return $results;
    }
public static function tableToArray()
    {
        $me        = new static();
        $cache_key = $me->cacheKey();

        // Return the array from the cache if it is present.
        if (Cache::has($cache_key)) {
            return (array) Cache::get($cache_key);
        }

        // Otherwise put the results into the cache and return them.
        $results = [];

        $query = static::all();

        // If the current model uses softDeletes then fix the
        // query to exclude those objects.
        foreach (class_uses(__CLASS__) as $traitName) {
            if ($traitName == 'SoftDeletes') {
                $query = static::whereNull('deleted_at')->get();
                break;
            }
        }

        /** @var Cacheable $row */
        foreach ($query as $row) {
            $results[$row->getIndexKey()] = $row->toFluent();
        }
        Cache::put($cache_key, $results, 60);
        return $results;
    }
Return a simple list of entries in the table.

May cache the results for up to 60 minutes.

@return	array of Fluent objects