You've already forked lubo_comment_query
							
							删除节目tag
This commit is contained in:
		| @@ -3,14 +3,13 @@ | ||||
| namespace App\Http\Controllers; | ||||
| 
 | ||||
| use App\Models\Programs; | ||||
| use App\Models\Tags; | ||||
| use Illuminate\Routing\Controller as BaseController; | ||||
| 
 | ||||
| class ProgramQueryController extends BaseController | ||||
| { | ||||
|     public function index() { | ||||
|         $keyword = request()->get("keyword", ""); | ||||
|         $programs = Programs::query()->with(["appends", "tag_pivots.tag", "video_pivots.video"])->limit(15)->orderByDesc("created_at")->get(); | ||||
|         $programs = Programs::query()->with(["appends", "video_pivots.video"])->limit(15)->orderByDesc("created_at")->get(); | ||||
|         return view("program", [ | ||||
|             "keyword" => $keyword, | ||||
|             "programs"=>$programs, | ||||
|   | ||||
| @@ -1,18 +0,0 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace App\Models; | ||||
| 
 | ||||
| use Illuminate\Database\Eloquent\Model; | ||||
| 
 | ||||
| class ProgramTags extends Model | ||||
| { | ||||
|     public function tag(): \Illuminate\Database\Eloquent\Relations\BelongsTo | ||||
|     { | ||||
|         return $this->belongsTo(Tags::class, "tag_id", "id"); | ||||
|     } | ||||
| 
 | ||||
|     public function program(): \Illuminate\Database\Eloquent\Relations\BelongsTo | ||||
|     { | ||||
|         return $this->belongsTo(Programs::class, "program_id", "id"); | ||||
|     } | ||||
| } | ||||
| @@ -11,16 +11,6 @@ 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"); | ||||
|     } | ||||
| 
 | ||||
|     public function video_pivots(): \Illuminate\Database\Eloquent\Relations\HasMany | ||||
|     { | ||||
|         return $this->hasMany(ProgramVideos::class, "program_id", "id"); | ||||
|   | ||||
| @@ -1,13 +0,0 @@ | ||||
| <?php | ||||
| 
 | ||||
| namespace App\Models; | ||||
| 
 | ||||
| use Illuminate\Database\Eloquent\Model; | ||||
| 
 | ||||
| class Tags extends Model | ||||
| { | ||||
|     public function programs(): \Illuminate\Database\Eloquent\Relations\HasManyThrough | ||||
|     { | ||||
|         return $this->hasManyThrough(Programs::class, ProgramTags::class, "tag_id", "id", "id", "program_id"); | ||||
|     } | ||||
| } | ||||
| @@ -15,7 +15,6 @@ | ||||
|         <thead> | ||||
|         <tr> | ||||
|             <td>节目名称</td> | ||||
|             <td>节目标签</td> | ||||
|             <td>点播及追加</td> | ||||
|             <td>视频地址及位置</td> | ||||
|             <td>结束时的画面</td> | ||||
| @@ -25,11 +24,6 @@ | ||||
|         @foreach($programs as $program) | ||||
|         <tr> | ||||
|             <td>{{$program->name}}</td> | ||||
|             <td> | ||||
|                 @foreach($program->tag_pivots as $tag_pivot) | ||||
|                     <div title="{{$tag_pivot->tag->comment}}">{{$tag_pivot->tag->name}}</div> | ||||
|                 @endforeach | ||||
|             </td> | ||||
|             <td> | ||||
|                 @foreach($program->appends as $append) | ||||
|                     @if($append->is_original) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user