All notable changes to Eloquent Viewable
will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
- Revert breaking change of
remember
method inViews
contract. The$lifetime
variable has now a default value ofnull
.
- Revert breaking change of
remember
method inViews
class. The$lifetime
variable has now a default value ofnull
.
- Added
bool
return typehint torecord
method inViews
contract. - Added
void
return typehint todestroy
method inViews
contract. - The
ViewRecordException
will be thrown when trying to record a view for a viewable type. - The
ViewRecorded
event will be fired when a new view is recorded. - Added
Views
typehint to globalviews()
function. - Added
bool
return typehint toisCrawler
method inCrawlerDetector
contract.
- Set required PHP versions in
composer.json
to^7.4|^8.0
. - The creating of the
View
instance has been moved into its own methodprotected function createView(): View
. - The
$viewable
argument of theforViewable
method inViews
contract cannot be nullable anymore. - Changed the method arguments of
orderByViews
andorderByUniqueViews
query scope inViewable
contract andInteractsWithViews
trait. - Changed the method arguments of
withViewsCount
query scope inInteractsWithViews
trait. - Added nullable
Period
class typehint to$period
argument ofperiod
method inViews
contract. - Made
$name
argument nullable inViews
contract. - Changed return typehint of
ip
method inVisitor
contract to?string
. - Change
DateTime
typehint toDateTimeInterface
inInvalidPeriod
exception.
- Removed
lifetime_in_minutes
option from config file.
- Fixed
count
method ofViews
class to count all views, including the collections (#241).
v5.2.1 (2020-09-22)
- Add support for Laravel 8
- Use
CyrildeWit\EloquentViewable\Contracts\Views
to resolve Views instance from container.
- Remove default value (
null
) for viewable inviews()
helper.
- Added
Views
contract. - Added
Visitor
contract. - Added the
Visitor
class which represents the current visitor. - Added protected
getViewableTypeSlug()
toCacheKey::class
. - Added
orderByViews
query scope toViewable
trait. - Added
orderByUniqueViews
query scope toViewable
trait. - Added
withViewsCount
query scope toViewable
trait.
- The
CyrildeWit\EloquentViewable\Viewable
trait has been renamed toCyrildeWit\EloquentViewable\InteractsWithViews
. - Renamed
session.key
tocooldown.key
in configuration file. - Changed the
Views
class constructor arguments. Added theVisitor
as first argument and removedVisitorCookieRepository $visitorCookieRepository
,rawlerDetector $crawlerDetector
andIpAddressResolver $ipAddressResolver
. - Replaced calls to
$this->crawlerDetector
inViews
with newVisitor
class implementation. - Replaced calls to
requestHasDoNotTrackHeader
inViews
with newVisitor
class implementation. - Changed type of primary key from
increments
tobigIncrements
inviews
table migration. - Bumped minimum requirements for Laravel framework components to
^6.0|^7.0
. - Removed check for provided viewable type in
getConnectionName()
,getDatabaseName()
,getModelSlug()
andgetKeySlug
inCacheKey::class
. - Renamed
ViewSessionHistory
class toCooldownMananger
. - Changed constructor of
CooldownManager
class. TheIlluminate\Contracts\Config\Repository
has been added as first parameter and the cooldown key is now retrieved from this instance. - The
Views
class now implements theViews
contract. - The constructor of the
Views
class has been changed. - Moved
Facades/Views
tosrc/
and renamed it toViewsFacade
. - The global
views()
helper now supports viewable types.
- Dropped support for
nesbot/carbon
^1.22. - Removed the deprecated
overrideIpAddress
method from theViews
class. - Removed the deprecated
overrideVisitor
method from theViews
class. - Removed
requestHasDoNotTrackHeader
method fromViews
class. - Removed
$viewableType
argument from constructor ofCacheKey::class
. - Removed static
fromViewableType
method fromCacheKey::class
. - Removed
HeaderResolver
contract and class. - Removed
IpAddressResolver
contract and class. - Removed
uniqueVisitor()
scope fromView
model. - Removed
Enums\SortDirection
class. - Removed
OrderByViewsScope
class. - Removed the
countByType
method from theViews
class. - Removed the
VisitorCookieRepository
(logic is move to theVisitor
class).
v4.1.1 (2019-10-18)
- Update required dependencies in composer.json to adhere to new Laravel 6 verison scheme
v4.1.0 (2019-09-03)
- Add support for Laravel 6
v4.0.0 (2019-07-01)
- Added
SortDirection
enum class that contains aDESCENDING
andASCENDING
constant - Added
OrderByViewsScope
class that can order a query by views based on some options - Added
collection($collection)
query scope toView
model - Added the ability to pass a collection to the
orderByViews
andorderByUniqueViews
query scope - Added a new
CacheKey
class with a new improved approach to making keys for the cache - Added
getStartDateTimestamp
andgetEndDateTimestamp
methods to thePeriod
class for internal use - Added
string $collection = null
argument topush
,createNamespaceKey
andcreateViewableKey
methods inViewSessionHistory
- Deprecated the
overrideIpAddress
method of theViews
class. Please use the newuseIpAddress(string $address)
method instead. - Deprecated the
overrideVisitor
method of theViews
class. Please use the newuseVisitor(string $visitor)
method instead.
- Replaced inner code of the
orderByViews
andorderByUniqueViews
query scope with the newOrderByViewsScope
class - Removed the
string
type declaration from thegetTable
method in theView
model class #165
- Removed the
Support\Key
class with its references
v3.2.0 (2019-03-03)
- Add support for Laravel 5.8
- Use String and Array classes instead of the helper functions
v3.1.0 (2019-01-29)
- Fixed the ability to pass an integer to the
delayInSession
method without getting an error - Type cast the cached views count otherwise PHP's type hint will fail
- Added the ability to override the visitor's unique ID that's used to distinguish unique views
- Added the ability to specify a cache store that should be used by this package
v3.0.2 (2018-12-25)
- The method
delayInSession
isn't working properly
v3.0.1 (2018-12-25)
- Publishing package migrations results in error (#133)
v3.0.0 (2018-12-17)
- Added
Views
class with facade - Added
IpAddressResolver
contract with implementation - Added
HeaderResolver
contract with implementation - Added
VisitorCookieRepository
class - Added global helper
views
- Added
collection
column to views table shema - Added
withinPeriod
scope toView
model - Added
uniqueVisitor
scope toView
model
- Bumped minimum required PHP version to ^7.1
- Require viewable models to implement the
Viewable
contract - Added global
views()
helper - Remove IP address as fallback for visitor cookie when it doesn't exists
- Changed the
isBot
method name toisCrawler
inCrawlerDetector
contract and updated theCrawlerDetectAdapter
- Changed the visibility of the
$detector
property fromprotected
toprivate
- Add support for
5.7.*
ofilluminate/config
tocomposer.json
- Moved config file from
publishable/config
toconfig/
- Replace
create_views_table
stub with real migration file and load it inside the service provider - Allow strings to be passed to the constructor of the
Period
class - Extracted key generation logic from
Period
class to theKey
class
- Removed the
ViewTracker
class - Removed the
ViewableService
class - Removed the
ProcessView
job - Removed the
update_views_table
migration file fromresources/database/migrations
- Removed
illuminate/bus
as dependency - Removed
illuminate/queue
as dependency - Removed
illuminate/routing
as dependency
orderByViewsCount
scope doesn't adhere to connection prefix
v2.4.3 (2018-10-21)
- Data too long for column
visitor
v2.4.2 (2018-10-21)
- ProcessView job is always failing
v2.4.1 (2018-09-12)
- View is saved before ProcessViews job is ran
v2.4.0 (2018-09-11)
- Add support for Laravel 5.7
- Deprecated the
CyrildeWit\Support\IpAddress
class - Deprecated the
CyrildeWit\Viewtracker
class - Deprecated the
scopeOrderByViewsCount
method in theViewable
trait - Deprecated the
scopeOrderByUniqueViewsCount
method in theViewable
trait
v2.3.0 (2018-07-23)
- Add
orderByUniqueViewsCount
scope toViewable
trait
v2.2.0 (2018-07-23)
- Add the ability to add a delay between views from the same session (#73)
- Caching is now turned off as default
v2.1.0 (2018-06-06)
This release accidentally contains no updates.
v2.0.0 (2018-05-28)
This major version contains some serious breaking changes! See the upgrade guide for more information!
- Added
visitor
collumn to thecreate_views_table
migration stub
- Changed the package name from
cyrildewit/laravel-page-view-counter
tocyrildewit/eloquent-viewable
- Renamed the
HasPageViewCounter
trait toViewable
- Renamed the
PageViewCounterServiceProvider
class toEloquentViewableServiceProvider
- Changed the namespace from
CyrildeWit\PageViewCounter\xxx
to 'CyrildeWit\EloquentViewable' - Added new options to the config file and changed the structure
- Replaced the
addPageView
method withaddView
in theViewable
trait - Replaced all
getPageViews<suffix>
methods withgetViews
in theViewable
trait
- Removed the
addPageViewThatExpiresAt
method from theViewable
trait - The DateTransformer functionality has been removed