Skip to content

Commit 328c4ad

Browse files
author
Naitik Patel
committed
casting date to Y-m-d H:i:s for unit testing
1 parent 0c040b5 commit 328c4ad

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

src/Kodeine/Acl/Models/Eloquent/Role.php

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace Kodeine\Acl\Models\Eloquent;
44

5+
use DateTimeInterface;
56
use Illuminate\Database\Eloquent\Model;
67
use Kodeine\Acl\Traits\HasPermission;
78

@@ -23,18 +24,24 @@ class Role extends Model
2324
*/
2425
protected $table;
2526

26-
protected $dates = [
27-
'created_at:Y-m-d H:i:s',
28-
'updated_at:Y-m-d H:i:s',
29-
];
30-
3127
public function __construct(array $attributes = [])
3228
{
3329
$this->table = config('acl.db_prefix') . 'roles';
3430

3531
parent::__construct($attributes);
3632
}
3733

34+
/**
35+
* Prepare a date for array / JSON serialization.
36+
*
37+
* @param DateTimeInterface $date
38+
* @return string
39+
*/
40+
protected function serializeDate(DateTimeInterface $date)
41+
{
42+
return $date->format('Y-m-d H:i:s');
43+
}
44+
3845
/**
3946
* Use the slug of the Role
4047
* instead of the ID.

0 commit comments

Comments
 (0)