You've already forked lubo_comment_query
							
							Tag顺序问题
This commit is contained in:
		| @@ -10,7 +10,7 @@ class ProgramQueryController extends BaseController | ||||
| { | ||||
|     public function index() { | ||||
|         $keyword = request()->get("keyword", ""); | ||||
|         $programs = Programs::query()->with(["appends", "tags", "video_pivots.video"])->limit(15)->orderByDesc("created_at")->get(); | ||||
|         $programs = Programs::query()->with(["appends", "tag_pivots.tag", "video_pivots.video"])->limit(15)->orderByDesc("created_at")->get(); | ||||
|         return view("program", [ | ||||
|             "keyword" => $keyword, | ||||
|             "programs"=>$programs, | ||||
|   | ||||
| @@ -11,6 +11,11 @@ class Programs extends Model | ||||
|         return $this->hasMany(ProgramAppends::class, "program_id", "id")->orderByDesc("is_original"); | ||||
|     } | ||||
| 
 | ||||
|     public function tag_pivots(): \Illuminate\Database\Eloquent\Relations\HasMany | ||||
|     { | ||||
|         return $this->hasMany(ProgramTags::class, "program_id", "id")->orderBy("id"); | ||||
|     } | ||||
| 
 | ||||
|     public function tags(): \Illuminate\Database\Eloquent\Relations\HasManyThrough | ||||
|     { | ||||
|         return $this->hasManyThrough(Tags::class, ProgramTags::class, "program_id", "id", "id", "tag_id"); | ||||
|   | ||||
| @@ -26,8 +26,8 @@ | ||||
|         <tr> | ||||
|             <td>{{$program->name}}</td> | ||||
|             <td> | ||||
|                 @foreach($program->tags as $tag) | ||||
|                     <div title="{{$tag->comment}}">{{$tag->name}}</div> | ||||
|                 @foreach($program->tag_pivots as $tag_pivot) | ||||
|                     <div title="{{$tag_pivot->tag->comment}}">{{$tag_pivot->tag->name}}</div> | ||||
|                 @endforeach | ||||
|             </td> | ||||
|             <td> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user