Skip to content

Commit

Permalink
Use HasTimestamps constants
Browse files Browse the repository at this point in the history
  • Loading branch information
indykoning committed Feb 10, 2025
1 parent 2235a2d commit 398f308
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src/Models/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ class Category extends Model
use HasAlternatesThroughRewrites;

protected $casts = [
'updated_at' => 'datetime',
self::UPDATED_AT => 'datetime',
self::CREATED_AT => 'datetime',
];

protected $appends = ['url'];
Expand All @@ -36,7 +37,7 @@ protected static function booting()
'children',
'children_count',
'position',
'updated_at',
self::UPDATED_AT,
];

$builder
Expand Down
7 changes: 6 additions & 1 deletion src/Models/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,13 @@ class Page extends Model

protected $primaryKey = 'page_id';

const CREATED_AT = 'creation_time';

const UPDATED_AT = 'update_time';

protected $casts = [
'update_time' => 'datetime',
self::UPDATED_AT => 'datetime',
self::CREATED_AT => 'datetime',
];

protected static function booting()
Expand Down
3 changes: 2 additions & 1 deletion src/Models/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class Product extends Model
protected $primaryKey = 'entity_id';

protected $casts = [
'updated_at' => 'datetime',
self::UPDATED_AT => 'datetime',
self::CREATED_AT => 'datetime',
];

protected $appends = ['url'];
Expand Down

0 comments on commit 398f308

Please sign in to comment.