You've already forked lubo_comment_query
							
							补充亿点内容,顺便立Flag
This commit is contained in:
		
							
								
								
									
										27
									
								
								app/Models/ProgramVideos.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								app/Models/ProgramVideos.php
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,27 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace App\Models; | ||||
| 
 | ||||
| use Illuminate\Database\Eloquent\Casts\Attribute; | ||||
| use Illuminate\Database\Eloquent\Model; | ||||
| use Illuminate\Support\Carbon; | ||||
| 
 | ||||
| class ProgramVideos extends Model | ||||
| { | ||||
|     public function program(): \Illuminate\Database\Eloquent\Relations\BelongsTo | ||||
|     { | ||||
|         return $this->belongsTo(Programs::class, "program_id", "id"); | ||||
|     } | ||||
| 
 | ||||
|     public function video(): \Illuminate\Database\Eloquent\Relations\BelongsTo | ||||
|     { | ||||
|         return $this->belongsTo(Videos::class, "video_bvid", "bvid"); | ||||
|     } | ||||
| 
 | ||||
|     public function startSec(): Attribute | ||||
|     { | ||||
|         return Attribute::get(function ($_, $attributes) { | ||||
|             return Carbon::createFromFormat("H:i:s", $attributes['start_time'])->secondsSinceMidnight(); | ||||
|         }); | ||||
|     } | ||||
| } | ||||
		Reference in New Issue
	
	Block a user