Initial commit of the L'Ami Fiduciaire SaaS platform built on Laravel 12, Vue 3, Inertia.js 2, and Tailwind CSS 4. Story 0.1 (rename folders to declarations in database) is implemented and code-reviewed: migration, rollback, and 6 Pest tests all passing. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
54 lines
1.4 KiB
PHP
54 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\Client;
|
|
|
|
use App\Http\Controllers\Controller;
|
|
use Illuminate\Http\RedirectResponse;
|
|
use Illuminate\Http\Request;
|
|
use Inertia\Inertia;
|
|
use Inertia\Response;
|
|
|
|
class RefuseController extends Controller
|
|
{
|
|
/**
|
|
* Show the refusal page.
|
|
*/
|
|
public function show(Request $request, string $token): Response
|
|
{
|
|
$invitation = $request->attributes->get('folder_invitation');
|
|
$folder = $invitation->folder;
|
|
|
|
$folder->load(['client']);
|
|
|
|
return Inertia::render('client/Refuse', [
|
|
'folder' => [
|
|
'id' => $folder->id,
|
|
'title' => $folder->title,
|
|
'client_name' => $folder->client->company_name,
|
|
],
|
|
'token' => $token,
|
|
'submitUrl' => route('client.refuse.store', ['token' => $token]),
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Store the refusal.
|
|
*/
|
|
public function store(Request $request, string $token): RedirectResponse
|
|
{
|
|
$invitation = $request->attributes->get('folder_invitation');
|
|
$folder = $invitation->folder;
|
|
|
|
$request->validate([
|
|
'reason' => ['nullable', 'string', 'max:65535'],
|
|
]);
|
|
|
|
$folder->update([
|
|
'refused_at' => now(),
|
|
'refusal_reason' => $request->input('reason'),
|
|
]);
|
|
|
|
return back()->with('flash', ['type' => 'success', 'message' => 'Refus enregistré.']);
|
|
}
|
|
}
|