feat: consolidar desenvolvimentos do portal InvestMoz
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Services\InvestmentGuides;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
|
||||
final class InvestmentGuideController extends Controller
|
||||
{
|
||||
public function index(Request $request, string $slug, InvestmentGuides $guides): Response|JsonResponse
|
||||
{
|
||||
$data = $guides->publicView($slug, $request->all());
|
||||
|
||||
return $request->expectsJson() ? response()->json($data) : Inertia::render('investment/guide', $data);
|
||||
}
|
||||
|
||||
public function show(Request $request, string $id, string $slug, InvestmentGuides $guides): Response|JsonResponse
|
||||
{
|
||||
$data = $guides->view($request->user(), $id, $slug, $request->all());
|
||||
|
||||
return $request->expectsJson() ? response()->json($data) : Inertia::render('investment/guide', $data);
|
||||
}
|
||||
|
||||
public function save(Request $request, string $id, string $slug, InvestmentGuides $guides): JsonResponse
|
||||
{
|
||||
return response()->json($guides->save($request->user(), $id, $slug, $request->all()));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user