System level banner testing

Logo

loki

Posted on: December 08, 2025

xdcfgvhb

 

<?php

namespace Modules\Corporate\Http\Controllers;

use App\Models\HelpTopicCategory;
use App\Models\HelpTopicContent;
use Illuminate\Contracts\Support\Renderable;
use Illuminate\Http\Request;
use Illuminate\Routing\Controller;

class HelpTopicController extends Controller
{
/**
* Display a listing of the resource.
* @return Renderable
*/
public function index()
{
return view('corporate::help-topics.index');
}

public function search(Request $request)
{
$search = $request->search;
$helpTopicCategories = HelpTopicCategory::corporateCategories();
if(isset($search) && $search != ''){
$helpTopicCategories->whereHas('helpTopicContents', function($q) use($search) {
$q->searchLike(['title', 'content'], $search);
});
$helpTopicCategories->with(['helpTopicContents' => function($q) use($search) {
$q->searchLike(['title', 'content'], $search);
}]);
}
else
{
$helpTopicCategories->with('helpTopicContents');
}

$helpTopicCategories = $helpTopicCategories->orderBy('sorting_order', 'asc')->orderBy('created_at', 'asc')->get();
// if ($request->isAPIRequest()){
// return response()->json(['success' => true, 'message' => 'Help Topics', 'data' => ['help_topics' => $helpTopicCategories]]);
// } else {
$renderedHelpTopicCategories = [];
foreach($helpTopicCategories as $helpTopicCategory)
{
$renderedHelpTopicCategories[] = view('corporate::help-topics.partials.help-category-card', compact('helpTopicCategory'))->render();
}
return response()->json(['success' => true, 'help_topic_categories' => $renderedHelpTopicCategories]);
// }
}

/**
* Show the form for creating a new resource.
* @return Renderable
*/
public function create()
{
return view('corporate::create');
}

/**
* Store a newly created resource in storage.
* @param Request $request
* @return Renderable
*/
public function store(Request $request)
{
//
}

/**
* Show the specified resource.
* @param int $id
* @return mixed
*/
public function show($id)
{
$helpTopic = HelpTopicContent::findOrFail($id);
$helpTopic = view('corporate::help-topics.partials.help-topic-detail', compact('helpTopic'))->render();

return response()->json(['success'=> true, 'help_topic' => $helpTopic]);
}

/**
* Show the form for editing the specified resource.
* @param int $id
* @return Renderable
*/
public function edit($id)
{
return view('corporate::edit');
}

/**
* Update the specified resource in storage.
* @param Request $request
* @param int $id
* @return Renderable
*/
public function update(Request $request, $id)
{
//
}

/**
* Remove the specified resource from storage.
* @param int $id
* @return Renderable
*/
public function destroy($id)
{
//
}
}

 

Continue Reading on the Source Platform