7
7
class Model
8
8
{
9
9
private $ name ;
10
- private $ timestamps = true ;
10
+ private $ timestamps = ' timestamps ' ;
11
11
private $ softDeletes = false ;
12
12
private $ columns = [];
13
13
@@ -34,34 +34,49 @@ public function columns(): array
34
34
return $ this ->columns ;
35
35
}
36
36
37
- public function usesTimestamps ()
37
+ public function primaryKey ()
38
+ {
39
+ return 'id ' ;
40
+ }
41
+
42
+ public function tableName ()
43
+ {
44
+ return Str::snake (Str::pluralStudly ($ this ->name ));
45
+ }
46
+
47
+ public function timestampsDataType (): string
38
48
{
39
49
return $ this ->timestamps ;
40
50
}
41
51
52
+ public function usesTimestamps (): bool
53
+ {
54
+ return $ this ->timestamps !== false ;
55
+ }
56
+
42
57
public function disableTimestamps ()
43
58
{
44
59
$ this ->timestamps = false ;
45
60
}
46
61
47
- public function primaryKey ( )
62
+ public function enableTimestamps ( bool $ withTimezone = false )
48
63
{
49
-
64
+ $ this -> timestamps = $ withTimezone ? ' timestampsTz ' : ' timestamps ' ;
50
65
}
51
66
52
- public function tableName ()
67
+ public function softDeletesDataType (): string
53
68
{
54
- return Str:: snake (Str:: pluralStudly ( $ this ->name )) ;
69
+ return $ this ->softDeletes ;
55
70
}
56
71
57
72
public function usesSoftDeletes (): bool
58
73
{
59
- return $ this ->softDeletes ;
74
+ return $ this ->softDeletes !== false ;
60
75
}
61
76
62
- public function enableSoftDeletes ()
77
+ public function enableSoftDeletes (bool $ withTimezone = false )
63
78
{
64
- $ this ->softDeletes = true ;
79
+ $ this ->softDeletes = $ withTimezone ? ' softDeletesTz ' : ' softDeletes ' ;
65
80
}
66
81
67
82
public function hasColumn (string $ name )
0 commit comments