protected function forgetExpiredViews(string $key)
    {
        $currentTime = Carbon::now();
        $viewHistory = $this->session->get($key, []);

        foreach ($viewHistory as $record) {
            if ($record['expires_at']->lte($currentTime)) {
                $recordId = array_search($record['viewable_id'], array_column($record, 'viewable_id'));

                $this->session->pull($key.$recordId);
            }
        }
    }
protected function forgetExpiredViews(string $key)
    {
        $currentTime = Carbon::now();
        $viewHistory = $this->session->get($key, []);

        foreach ($viewHistory as $record) {
            if ($record['expires_at']->lte($currentTime)) {
                $recordId = array_search($record['viewable_id'], array_column($record, 'viewable_id'));

                $this->session->pull($key.$recordId);
            }
        }
    }
protected function forgetExpiredViews ( string $ key ) { $ currentTime = Carbon :: now ( ) ; $ viewHistory = $ this -> session -> get ( $ key , [ ] ) ; foreach ( $ viewHistory as $ record ) { if ( $ record [ 'expires_at' ] -> lte ( $ currentTime ) ) { $ recordId = array_search ( $ record [ 'viewable_id' ] , array_column ( $ record , 'viewable_id' ) ) ; $ this -> session -> pull ( $ key . $ recordId ) ; } } }
Remove all expired views from the session.

@param  string  $key
@return void
Remove all expired views from the session .