You've already forked lubo_comment_query
							
							
		
			
				
	
	
		
			25 lines
		
	
	
		
			790 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			25 lines
		
	
	
		
			790 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Models;
 | |
| 
 | |
| use Illuminate\Database\Eloquent\Model;
 | |
| 
 | |
| class Programs extends Model
 | |
| {
 | |
|     protected $fillable = ["name", "difficulty", "desc"];
 | |
|     public function appends(): \Illuminate\Database\Eloquent\Relations\HasMany
 | |
|     {
 | |
|         return $this->hasMany(ProgramAppends::class, "program_id", "id")->orderByDesc("is_original")->orderBy("created_at");
 | |
|     }
 | |
| 
 | |
|     public function video_pivots(): \Illuminate\Database\Eloquent\Relations\HasMany
 | |
|     {
 | |
|         return $this->hasMany(ProgramVideos::class, "program_id", "id")->orderByDesc("created_at");
 | |
|     }
 | |
| 
 | |
|     public function videos(): \Illuminate\Database\Eloquent\Relations\HasManyThrough
 | |
|     {
 | |
|         return $this->hasManyThrough(Videos::class, ProgramVideos::class, "program_id", "bvid", "id", "video_bvid");
 | |
|     }
 | |
| }
 |