Files
UNIT3D-Community-Edition/app/Http/Controllers/WikiController.php
HDVinnie 757af7be3e add: wikis system
- migrations needed
- views need to be updated to latest unit3d structure
2023-12-19 18:21:43 -05:00

41 lines
1.2 KiB
PHP

<?php
/**
* NOTICE OF LICENSE.
*
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
* The details is bundled with this project in the file LICENSE.txt.
*
* @project UNIT3D Community Edition
*
* @author HDVinnie <hdinnovations@protonmail.com>
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
*/
namespace App\Http\Controllers;
use App\Models\Wiki;
use App\Models\WikiCategory;
class WikiController extends Controller
{
/**
* Display All Wikis.
*/
public function index(): \Illuminate\Contracts\View\View|\Illuminate\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\Foundation\Application
{
$wiki_categories = WikiCategory::with(['wikis'])->get()->sortBy('position');
return view('wiki.index', ['wiki_categories' => $wiki_categories]);
}
/**
* Show A Wiki.
*/
public function show(int $id): \Illuminate\Contracts\View\View|\Illuminate\Foundation\Application|\Illuminate\Contracts\View\Factory|\Illuminate\Contracts\Foundation\Application
{
$wiki = Wiki::findOrFail($id);
return view('wiki.show', ['wiki' => $wiki]);
}
}