编辑追加时,展示节目结束图

This commit is contained in:
Jerry Yan 2022-08-02 11:33:48 +08:00
parent 9d382e1725
commit 8d765ad31f
3 changed files with 18 additions and 4 deletions

View File

@ -42,9 +42,9 @@ class ProgramAppendConstructController extends BaseController
])); ]));
} }
public function edit(Request $request, Programs $program, ProgramAppends $append) { public function edit(Request $request, ProgramAppends $append) {
return view("program.construct.append.create", [ return view("program.construct.append.create", [
"program" => $program, "program" => $append->program,
"append" => $append "append" => $append
]); ]);
} }

View File

@ -8,4 +8,8 @@ class ProgramAppends extends Model
{ {
protected $fillable = ["name", "from", "price", "append"]; protected $fillable = ["name", "from", "price", "append"];
protected $dateFormat = "U"; protected $dateFormat = "U";
public function program(): \Illuminate\Database\Eloquent\Relations\BelongsTo
{
return $this->belongsTo(Programs::class, "program_id", "id");
}
} }

View File

@ -9,11 +9,19 @@
@include("common.header") @include("common.header")
<form class="w-full lg:w-1/2 lg:ml-6 border-2" action="" method="post" enctype="multipart/form-data"> <form class="w-full lg:w-1/2 lg:ml-6 border-2" action="" method="post" enctype="multipart/form-data">
<input type="hidden" name="id" value="{{$append->id}}"> <input type="hidden" name="id" value="{{$append->id}}">
<input type="hidden" name="program_id" value="{{$program->id}}"> @if($program)
@if($program->video_pivots->last()->stop_image)
<label class="block my-2"> <label class="block my-2">
结束图像 结束图像
@if(count($program->video_pivots) > 0 && $program->video_pivots->last()->stop_image)
<img src="{{$program->video_pivots->last()->stop_image}}" alt="结束图片"> <img src="{{$program->video_pivots->last()->stop_image}}" alt="结束图片">
@else
<div>
<a href="{{route("program.construct.video.list", ["program"=>$program->id])}}"
class="block px-6 py-2 inline-block rounded-full bg-cyan-600 text-white">
去建设
</a>
</div>
@endif
</label> </label>
@endif @endif
<label class="block my-2"> <label class="block my-2">
@ -45,6 +53,7 @@
<input class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white" type="submit"> <input class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white" type="submit">
</div> </div>
<div class="block my-2"> <div class="block my-2">
@if(count($program->video_pivots) > 0)
<a class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white" target="_blank" <a class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white" target="_blank"
href="https://www.bilibili.com/video/{{$program->video_pivots->first()->video_bvid}}?p={{$program->video_pivots->first()->start_part}}&t={{$program->video_pivots->first()->start_sec}}" href="https://www.bilibili.com/video/{{$program->video_pivots->first()->video_bvid}}?p={{$program->video_pivots->first()->start_part}}&t={{$program->video_pivots->first()->start_sec}}"
title="P{{$program->video_pivots->first()->start_part}}#{{$program->video_pivots->first()->start_time}}" title="P{{$program->video_pivots->first()->start_part}}#{{$program->video_pivots->first()->start_time}}"
@ -53,6 +62,7 @@
href="https://www.bilibili.com/video/{{$program->video_pivots->last()->video_bvid}}?p={{$program->video_pivots->last()->stop_part}}&t={{$program->video_pivots->last()->stop_sec}}" href="https://www.bilibili.com/video/{{$program->video_pivots->last()->video_bvid}}?p={{$program->video_pivots->last()->stop_part}}&t={{$program->video_pivots->last()->stop_sec}}"
title="P{{$program->video_pivots->last()->stop_part}}#{{$program->video_pivots->last()->stop_time}}" title="P{{$program->video_pivots->last()->stop_part}}#{{$program->video_pivots->last()->stop_time}}"
>打开至结束位置</a> >打开至结束位置</a>
@endif
<a class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white" <a class="px-6 py-2 inline-block rounded-full bg-cyan-600 text-white"
href="{{route('program.construct.append.list', ['program'=>$program->id])}}" href="{{route('program.construct.append.list', ['program'=>$program->id])}}"
>返回列表</a> >返回列表</a>