添加建设内容

This commit is contained in:
2022-07-29 10:45:13 +08:00
parent d0e816ec6e
commit 4f31bd50c3
17 changed files with 446 additions and 23 deletions

View File

@ -0,0 +1,35 @@
<?php
namespace App\Http\Controllers;
use App\Models\Programs;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller as BaseController;
class ProgramConstructController extends BaseController
{
public function construct(Request $request) {
$keyword = $request->get("keyword", "");
$programs = Programs::query()->with(["appends", "video_pivots.video"])->where("status", "=", 0)->limit(15)->orderByDesc("created_at")->get();
return view("program.construct.index", [
"keyword" => $keyword,
"programs"=>$programs,
]);
}
public function edit(Request $request, Programs $program) {
return view("program.construct.create", [
"program"=>$program
]);
}
public function submit(Request $request, Programs $program) {
$updatePayload = $request->only(["name", "difficulty", "desc"]);
$program->status = $request->post("status", 0);
$program->created_at = $request->post("created_at");
$program->update($updatePayload);
return view("program.construct.create", [
"program"=>$program
]);
}
}