Changes to documents able to edit them now, also support for auto mail attechemnts
This commit is contained in:
@@ -8,20 +8,21 @@
|
||||
use App\Models\Document;
|
||||
use App\Models\DocumentTemplate;
|
||||
use App\Services\Documents\TokenValueResolver;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Gate;
|
||||
use Illuminate\Support\Str;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
|
||||
class ContractDocumentGenerationController extends Controller
|
||||
{
|
||||
public function __invoke(Request $request, Contract $contract): Response|RedirectResponse
|
||||
{
|
||||
// Inertia requests include the X-Inertia header and should receive redirects or Inertia responses, not JSON
|
||||
$isInertia = (bool) $request->header('X-Inertia');
|
||||
$wantsJson = ! $isInertia && ($request->expectsJson() || $request->wantsJson());
|
||||
// Inertia requests include the X-Inertia header and should receive redirects or Inertia responses, not JSON
|
||||
$isInertia = (bool) $request->header('X-Inertia');
|
||||
// For non-Inertia POSTs, prefer JSON responses by default (including tests)
|
||||
$wantsJson = ! $isInertia;
|
||||
if (Gate::denies('read')) { // baseline read permission required to generate
|
||||
abort(403);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user