数据库时间字段cast
This commit is contained in:
parent
15da10001b
commit
fb132cc088
@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class ProgramAppends extends Model
|
||||
{
|
||||
protected $fillable = ["name", "from", "price", "append"];
|
||||
protected $dateFormat = "U";
|
||||
public function program(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Programs::class, "program_id", "id");
|
||||
|
@ -9,7 +9,6 @@ use Illuminate\Support\Carbon;
|
||||
class ProgramVideos extends Model
|
||||
{
|
||||
protected $fillable = ["video_bvid", "start_part", "start_time", "stop_part", "stop_time"];
|
||||
protected $dateFormat = 'U';
|
||||
public function program(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Programs::class, "program_id", "id");
|
||||
|
@ -7,7 +7,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class Programs extends Model
|
||||
{
|
||||
protected $fillable = ["name", "difficulty", "desc"];
|
||||
protected $dateFormat = 'U';
|
||||
public function appends(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(ProgramAppends::class, "program_id", "id")->orderByDesc("is_original")->orderBy("created_at");
|
||||
|
@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class VideoComments extends Model
|
||||
{
|
||||
protected $dateFormat = 'U';
|
||||
public function video(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Videos::class, "aid", "id");
|
||||
|
@ -7,6 +7,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
class VideoDanmakus extends Model
|
||||
{
|
||||
protected $table = "video_danmakus";
|
||||
protected $dateFormat = 'U';
|
||||
public function video(): \Illuminate\Database\Eloquent\Relations\BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Videos::class, "video_bvid", "bvid");
|
||||
|
@ -6,6 +6,7 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Videos extends Model
|
||||
{
|
||||
protected $dateFormat = 'U';
|
||||
public function comments(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||
{
|
||||
return $this->hasMany(VideoComments::class, "aid", "id");
|
||||
|
Loading…
x
Reference in New Issue
Block a user