You've already forked lubo_comment_query
添加建设内容
This commit is contained in:
@ -8,6 +8,8 @@ use Illuminate\Support\Carbon;
|
||||
|
||||
class ProgramVideos extends Model
|
||||
{
|
||||
protected $fillable = ["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");
|
||||
@ -21,7 +23,20 @@ class ProgramVideos extends Model
|
||||
public function startSec(): Attribute
|
||||
{
|
||||
return Attribute::get(function ($_, $attributes) {
|
||||
if (!$attributes['start_time']) {
|
||||
return "";
|
||||
}
|
||||
return Carbon::createFromFormat("H:i:s", $attributes['start_time'])->secondsSinceMidnight();
|
||||
});
|
||||
}
|
||||
|
||||
public function stopSec(): Attribute
|
||||
{
|
||||
return Attribute::get(function ($_, $attributes) {
|
||||
if (!$attributes['stop_time']) {
|
||||
return "";
|
||||
}
|
||||
return Carbon::createFromFormat("H:i:s", $attributes['stop_time'])->secondsSinceMidnight();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user