File: /home/xedaptot/ai.naniguide.com/app/Http/Controllers/TutorialViewController.php
<?php
namespace App\Http\Controllers;
use App\Model\Tutorial;
use Illuminate\Http\Request;
class TutorialViewController extends Controller
{
/**
* Render a tutorial as a bare HTML page (no layout) for use inside an iframe.
* Accessible to any authenticated user (admin or customer).
*/
public function show(Request $request, string $slug)
{
$tutorial = Tutorial::active()->where('slug', $slug)->first();
if (!$tutorial) {
return response(
view('tutorials.not_found')->render(),
404
);
}
$locale = $request->query('locale', app()->getLocale() ?? 'en');
$content = $tutorial->getContent($locale);
return view('tutorials.show', [
'tutorial' => $tutorial,
'content' => $content,
'locale' => $locale,
]);
}
}