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");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user