uawdijnntqw1x1x1
IP : 216.73.216.130
Hostname : it-staging-server
Kernel : Linux it-staging-server 5.15.0-131-generic #141-Ubuntu SMP Fri Jan 10 21:18:28 UTC 2025 x86_64
Disable Function : None :)
OS : Linux
PATH:
/
home
/
forge
/
stage.sksb.smartcon-survey.com
/
app
/
Console
/
..
/
Http
/
Controllers
/
TopicController.php
/
/
<?php namespace App\Http\Controllers; use App\Models\Topic; use Illuminate\Contracts\Foundation\Application; use Illuminate\Contracts\View\Factory; use Illuminate\Contracts\View\View; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Http\Response; use Illuminate\Routing\Redirector; use stdClass; class TopicController extends Controller { /** * Display a listing of the resource. * * @return Application|Factory|View */ public function index() { return view('admin.topics.index', ['topics' => Topic::all()]); } /** * Show the form for creating a new resource. * * @return Application|Factory|View */ public function create() { $topic = new stdClass; $topic->id = 0; $topic->name = ''; $topic->is_active = 1; $topic->is_extra = 0; $topic->order = 0; $topic->surveyJson = ''; return view('admin.topics.edit', ['topic' => $topic]); } /** * Store a newly created resource in storage. * * @return Application|Redirector|RedirectResponse */ public function store(Request $request) { $validated = $request->validate([ 'topic-name' => 'required|string', 'isactive' => 'required|numeric', 'isextra' => 'required|numeric', 'order' => 'required|numeric', 'survey-json' => 'required|json', ]); $topic = new Topic; $topic->name = $validated['topic-name']; $topic->is_active = $validated['isactive']; $topic->is_extra = $validated['isextra']; $topic->order = $validated['order']; $topic->surveyJson = $validated['survey-json']; $topic->save(); return redirect(route('topics.index')); } /** * Display the specified resource. * * @return Response */ public function show(Topic $topic) { // } /** * Show the form for editing the specified resource. * * @return Application|Factory|View */ public function edit(Topic $topic) { return view('admin.topics.edit', ['topic' => $topic]); } /** * Update the specified resource in storage. * * @return Application|Redirector|RedirectResponse */ public function update(Request $request) { $validated = $request->validate([ 'topic-name' => 'required|string', 'isactive' => 'required|numeric', 'isextra' => 'required|numeric', 'order' => 'required|numeric', 'survey-json' => 'required|json', ]); $topic = Topic::where('id', '=', $request['topic-id'])->first(); $topic->name = $validated['topic-name']; $topic->is_active = (int) $validated['isactive']; $topic->is_extra = (int) $validated['isextra']; $topic->order = (int) $validated['order']; $topic->surveyJson = $validated['survey-json']; $topic->save(); session()->flash('topic_update_success', 'Das Thema wurde erfolgreich aktualisiert.'); return redirect(route('topics.edit', $request['topic-id'])); } /** * Remove the specified resource from storage. * * @return false|string */ public function destroy(Topic $topic): Response { Topic::destroy($topic->id); return json_encode(['success']); } }
/home/forge/stage.sksb.smartcon-survey.com/app/Console/../Http/Controllers/TopicController.php