feat: consolidar desenvolvimentos do portal InvestMoz
This commit is contained in:
@@ -6,11 +6,26 @@ use App\Models\Opportunity;
|
||||
use App\Services\ProactiveSupply;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Inertia\Inertia;
|
||||
use Inertia\Response;
|
||||
|
||||
final class ProactiveSupplyController extends Controller
|
||||
{
|
||||
public function review(Request $request, ProactiveSupply $service): JsonResponse|Response
|
||||
{
|
||||
$service->authorize($request->user());
|
||||
$v = $request->validate(['record_id' => 'nullable|integer|min:1']);
|
||||
$record = isset($v['record_id']) ? Opportunity::whereKey($v['record_id'])->firstOrFail() : null;
|
||||
$data = $service->review($request->user(), $request->all(), $record);
|
||||
$data['recordId'] = isset($v['record_id']) ? (int) $v['record_id'] : null;
|
||||
|
||||
return $request->expectsJson() ? response()->json($data)->header('Cache-Control', 'private, no-store')
|
||||
: Inertia::render('management/proactive-supply-review', $data);
|
||||
}
|
||||
|
||||
public function index(Request $request, ProactiveSupply $service): JsonResponse
|
||||
{
|
||||
$service->authorize($request->user());
|
||||
$v = $request->validate(['record_id' => 'nullable|integer|min:1']);
|
||||
$record = isset($v['record_id']) ? Opportunity::whereKey($v['record_id'])->firstOrFail() : null;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user