-
Notifications
You must be signed in to change notification settings - Fork 0
/
BotModelBase.php
55 lines (46 loc) · 1.02 KB
/
BotModelBase.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use DateTimeInterface;
/**
* Class BotModelBase
*
* @package App\Models
*
* @mixin \Illuminate\Database\Query\Builder
* @mixin \Illuminate\Database\Eloquent\Builder
*/
class BotModelBase extends Model
{
public static $useOldFormat = false;
protected $connection = 'mysql_bot';
/**
* The default guarded columns for a model.
*
* @var array
*/
protected $guarded = ['id'];
protected $hidden = [
'created_at',
'updated_at',
'deleted_at',
];
protected $dates = [
'created_at',
'updated_at',
'deleted_at',
];
/**
* Prepare a date for array / JSON serialization.
*
* @param \DateTimeInterface $date
* @return string
*/
protected function serializeDate(DateTimeInterface $date)
{
if (self::$useOldFormat) {
return $date->format('Y-m-d H:i:s');
}
return parent::serializeDate($date);
}
}