You've already forked lubo_comment_query
建设相关的路由,及大部分提交的验证,及视频对应的真·节目单
This commit is contained in:
@ -17,6 +17,44 @@ class ProgramVideoConstructController extends BaseController
|
||||
]);
|
||||
}
|
||||
|
||||
public function add(Request $request) {
|
||||
return view("program.construct.video.create", [
|
||||
"program_video" => new ProgramVideos()
|
||||
]);
|
||||
}
|
||||
|
||||
public function create(Request $request, Programs $program) {
|
||||
$request->validate([
|
||||
"start_part" => ["required", "int"],
|
||||
"stop_part" => ["required", "int"],
|
||||
"start_time" => ["required", "date_format:H:i:s"],
|
||||
"stop_time" => ["required", "date_format:H:i:s"],
|
||||
"created_at" => ["required", "date"],
|
||||
]);
|
||||
$program_video = new ProgramVideos();
|
||||
$createPayload = $request->only(["start_part", "start_time", "stop_part", "stop_time"]);
|
||||
$program_video->fill($createPayload);
|
||||
if ($request->hasFile("start_image")) {
|
||||
$file = $request->file("start_image");
|
||||
$path = $file->store("lubo_file");
|
||||
$full_path = Storage::url($path);
|
||||
// $program_video->start_image = str_replace("jerryyan.top", "jerryyan.net", $full_path);
|
||||
$program_video->start_image = $full_path;
|
||||
}
|
||||
if ($request->hasFile("stop_image")) {
|
||||
$file = $request->file("stop_image");
|
||||
$path = $file->store("lubo_file");
|
||||
$full_path = Storage::url($path);
|
||||
// $program_video->stop_image = str_replace("jerryyan.top", "jerryyan.net", $full_path);
|
||||
$program_video->stop_image = $full_path;
|
||||
}
|
||||
$program_video->created_at = $request->post("created_at");
|
||||
$program->video_pivots()->save($program_video);
|
||||
return redirect(route("program.construct.video.list", [
|
||||
"program"=>$program_video->program_id
|
||||
]));
|
||||
}
|
||||
|
||||
public function edit(Request $request, ProgramVideos $program_video) {
|
||||
return view("program.construct.video.create", [
|
||||
"program_video" => $program_video
|
||||
@ -24,6 +62,13 @@ class ProgramVideoConstructController extends BaseController
|
||||
}
|
||||
|
||||
public function submit(Request $request, ProgramVideos $program_video) {
|
||||
$request->validate([
|
||||
"start_part" => ["required", "int"],
|
||||
"stop_part" => ["required", "int"],
|
||||
"start_time" => ["required", "date_format:H:i:s"],
|
||||
"stop_time" => ["required", "date_format:H:i:s"],
|
||||
"created_at" => ["required", "date"],
|
||||
]);
|
||||
$updatePayload = $request->only(["start_part", "start_time", "stop_part", "stop_time"]);
|
||||
if ($request->hasFile("start_image")) {
|
||||
$file = $request->file("start_image");
|
||||
|
Reference in New Issue
Block a user