You've already forked lubo_comment_query
添加点播信息建设内容
This commit is contained in:
53
app/Http/Controllers/ProgramAppendConstructController.php
Normal file
53
app/Http/Controllers/ProgramAppendConstructController.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\ProgramAppends;
|
||||
use App\Models\Programs;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
|
||||
class ProgramAppendConstructController extends BaseController
|
||||
{
|
||||
public function construct(Request $request, Programs $program) {
|
||||
return view("program.construct.append.index", [
|
||||
"program" => $program,
|
||||
"appends" => $program->appends,
|
||||
]);
|
||||
}
|
||||
|
||||
public function add(Request $request, Programs $program) {
|
||||
return view("program.construct.append.create", [
|
||||
"program" => $program,
|
||||
"append" => new ProgramAppends()
|
||||
]);
|
||||
}
|
||||
|
||||
public function create(Request $request, Programs $program) {
|
||||
$createPayload = $request->only(["name", "from", "price", "append"]);
|
||||
$append = $program->appends()->create($createPayload);
|
||||
$append->is_original = $request->post("is_original", 0);
|
||||
$append->save();
|
||||
return redirect(route("program.construct.append.list", [
|
||||
"program"=>$program->id,
|
||||
]));
|
||||
}
|
||||
|
||||
public function edit(Request $request, Programs $program, ProgramAppends $append) {
|
||||
return view("program.construct.append.create", [
|
||||
"program" => $program,
|
||||
"append" => $append
|
||||
]);
|
||||
}
|
||||
|
||||
public function submit(Request $request, Programs $program, ProgramAppends $append) {
|
||||
$submitPayload = $request->only(["name", "from", "price", "append"]);
|
||||
$append->update($submitPayload);
|
||||
$append->is_original = $request->post("is_original", 0);
|
||||
$append->save();
|
||||
return redirect(route("program.construct.append.list", [
|
||||
"program"=>$program->id,
|
||||
]));
|
||||
}
|
||||
|
||||
}
|
@ -6,5 +6,6 @@ use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class ProgramAppends extends Model
|
||||
{
|
||||
|
||||
protected $fillable = ["name", "from", "price", "append"];
|
||||
protected $dateFormat = "U";
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ class ProgramVideos extends Model
|
||||
public function startSec(): Attribute
|
||||
{
|
||||
return Attribute::get(function ($_, $attributes) {
|
||||
if (!$attributes['start_time']) {
|
||||
if (!isset($attributes['start_time'])) {
|
||||
return "";
|
||||
}
|
||||
return Carbon::createFromFormat("H:i:s", $attributes['start_time'])->secondsSinceMidnight();
|
||||
@ -33,7 +33,7 @@ class ProgramVideos extends Model
|
||||
public function stopSec(): Attribute
|
||||
{
|
||||
return Attribute::get(function ($_, $attributes) {
|
||||
if (!$attributes['stop_time']) {
|
||||
if (!isset($attributes['stop_time'])) {
|
||||
return "";
|
||||
}
|
||||
return Carbon::createFromFormat("H:i:s", $attributes['stop_time'])->secondsSinceMidnight();
|
||||
|
Reference in New Issue
Block a user