You've already forked lubo_comment_query
							
							
		
			
				
	
	
		
			47 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Http\Controllers;
 | |
| 
 | |
| use App\Models\Programs;
 | |
| use App\Models\ProgramVideos;
 | |
| use Illuminate\Http\Request;
 | |
| use Illuminate\Routing\Controller as BaseController;
 | |
| use Illuminate\Support\Facades\Storage;
 | |
| 
 | |
| class ProgramVideoConstructController extends BaseController
 | |
| {
 | |
|     public function index(Request $request, Programs $program) {
 | |
|         return view("program.construct.video.index", [
 | |
|             "program" => $program,
 | |
|             "videos" => $program->video_pivots,
 | |
|         ]);
 | |
|     }
 | |
| 
 | |
|     public function edit(Request $request, ProgramVideos $program_video) {
 | |
|         return view("program.construct.video.create", [
 | |
|             "program_video" => $program_video
 | |
|         ]);
 | |
|     }
 | |
| 
 | |
|     public function submit(Request $request, ProgramVideos $program_video) {
 | |
|         $updatePayload = $request->only(["start_part", "start_time", "stop_part", "stop_time"]);
 | |
|         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);
 | |
|         }
 | |
|         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->created_at = $request->post("created_at");
 | |
|         $program_video->update($updatePayload);
 | |
|         return redirect(route("program.construct.video.list", [
 | |
|             "program"=>$program_video->program_id
 | |
|         ]));
 | |
|     }
 | |
| }
 |