I want to pass the id to my modal and save the id as the application id in my controller and save it to DB. But I can’t access the id.
Here is my button in applications.blade:
<a href="#" class="block px-5 py-1 hover:bg-gray-100"
x-on:click="$dispatch('open-modal', 'bspms-attachments')">Attach
</a>
Here is my form in toggle-button
<div id="uploadModal1" class="modal">
<div class="modal-content">
<span class="close" id="closeModal1">×</span>
<h2>Upload File</h2>
<form action="{{ route('file.upload') }}" method="POST" enctype="multipart/form-data">
@csrf
<input type="file" name="fileInput1">
<button type="submit">Upload</button>
</form>
</div>
</div>
this toggle-button is the content of my modal which is called in my modals.blade:
<x-pop-up name="bspms-attachments" :show="false" focusable class="w-[650px]">
{{-- Define the width for the modal. The minimum width is 500px --}}
<x-slot:title>
Documents/Attachments
</x-slot:title>
{{-- Content starts here --}}
<x-toggle-button></x-toggle-button>
</x-pop-up>
and here is my controller that saves it to database:
ApplicationsAttachment::create([
'application_id' => ,
'file_name' => $fileInputName,
'file_type' => explode('/', $originalFile->getMimeType())[1],
'file_path' => $filePath,
'file_size' => $originalFile->getMaxFilesize(),
]);
I can’t even verify if I can retrieve the id in my modal because I can’t even show it in my console.