删除节目tag
This commit is contained in:
parent
710a9f44a5
commit
04a797eaac
@ -3,14 +3,13 @@
|
|||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Models\Programs;
|
use App\Models\Programs;
|
||||||
use App\Models\Tags;
|
|
||||||
use Illuminate\Routing\Controller as BaseController;
|
use Illuminate\Routing\Controller as BaseController;
|
||||||
|
|
||||||
class ProgramQueryController extends BaseController
|
class ProgramQueryController extends BaseController
|
||||||
{
|
{
|
||||||
public function index() {
|
public function index() {
|
||||||
$keyword = request()->get("keyword", "");
|
$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", [
|
return view("program", [
|
||||||
"keyword" => $keyword,
|
"keyword" => $keyword,
|
||||||
"programs"=>$programs,
|
"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");
|
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
|
public function video_pivots(): \Illuminate\Database\Eloquent\Relations\HasMany
|
||||||
{
|
{
|
||||||
return $this->hasMany(ProgramVideos::class, "program_id", "id");
|
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>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<td>节目名称</td>
|
<td>节目名称</td>
|
||||||
<td>节目标签</td>
|
|
||||||
<td>点播及追加</td>
|
<td>点播及追加</td>
|
||||||
<td>视频地址及位置</td>
|
<td>视频地址及位置</td>
|
||||||
<td>结束时的画面</td>
|
<td>结束时的画面</td>
|
||||||
@ -25,11 +24,6 @@
|
|||||||
@foreach($programs as $program)
|
@foreach($programs as $program)
|
||||||
<tr>
|
<tr>
|
||||||
<td>{{$program->name}}</td>
|
<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>
|
<td>
|
||||||
@foreach($program->appends as $append)
|
@foreach($program->appends as $append)
|
||||||
@if($append->is_original)
|
@if($append->is_original)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user