Updating database records from a form using Laravel - Request not pulling variable

I am new to Laravel and I am trying to update a grantor's details via a form, however the record in the database table is not registering any changes. The issue appears to concern the Request not picking up the data stored in the variable, as when the code $grantor->grantor_name= $request->input('grantor_name'); is replaced with $grantor->grantor_name= "updated_data";, the database table does update with the "updated_data" string. I will include snippets of my existing code for clarity. Any help with this problem would be greatly appreciated!

Grantor Controller File

public function update(Request $request, $id)
    {
        $grantor = Grantor::find($id);
        $grantor->grantor_name= $request->input('grantor_name');
        $grantor->save();

Grantors.edit.blade File

<div class="flex-1 px-10">
      <form method="post" action="{{route('grantors.update', $grantor->id )}}" class="is-readonly"> 
     @csrf
      
        <div class="row">
            @if ($errors->any()) <span>{{ $errors }}</span> @endif
         </div>
         <div class="h-auto md:h-96">

            <!-- item -->
            <div x-data=" {isOpen : false} " class="pt-2 pb-4 border-b border-divider">
              <div @click="isOpen = !isOpen"
                class="flex items-center cursor-pointer text-neutral-darker hover:text-primary-hover"
                :class="{'font-bold' : isOpen}">
                <span class="text-xl md:xl">Grantor Details</span>
                <img class="mb-1 duration-300 ml-4 inset-0 h-6 w-6" :class="{'transform rotate-180' : isOpen}"
                    src="../../img/icon-arrow-down.png" alt="Dropdown-arrow">
              </div>
              <div x-show.transition.duration.300ms.origin.bottom="isOpen" x-cloak @click.away="isOpen = false"
                class="pt-3 text-sm text-neutral">
                 @if($is_editable)
                <div class="flex justify-end">
                <button type="button" class="btn btn-default btn-edit js-edit"><img class="mb-1 duration-300 ml-4 inset-0 h-6 w-6" src="../../img/edit-icon.svg" alt="edit icon"></button>
                <button type="button" class="btn btn-default btn-save js-save"><img class="mb-1 duration-300 ml-4 inset-0 h-6 w-6" src="../../img/save-icon.svg" alt="save icon"></button>
                </div>
                @endif 
                <form class="w-full">
                  <div class="px-6 sm:px-6">
                   <div class="md:flex items-center">
                    <div class="w-full md:w-1/2 flex flex-col">
                      <div class="md:flex md:items-center">
                        <label for="grantor_name" class="font-bold text-neutral-darker leading-none pr-4" for="inline-full-name" disabled>Grantor/ Company/ Organisation Name *</label>
                        <input class="leading-none text-gray-900 py-2 px-4 w-80 focus:outline-none focus:border-blue-700 mt-4 bg-gray-100 border rounded border-gray-200 is-disabled @error('grantor_name') is-invalid @enderror" name="grantor_name" value="{{ $grantor->grantor_name }}" id="grantor_name" type="text" disabled >
                    </div>
                  </div>
                </div>

Tenant Routes File

Route::get('/grantors/{id}/edit', [App\Http\Controllers\GrantorController::class, 'edit'])->name('grantors.edit');
Route::post('/grantors/{id}/update', [App\Http\Controllers\GrantorController::class, 'update'])->name('grantors.update');

Grantor Model

protected $table = 'grantors';
protected $fillable= [
    'grantor_name'
]);

Solution 1:

Your grantor_name input has the disabled attribute applied so will not be passed through as part of the form submission. Remove disabled then the input plus its value be submitted.

If you do not want people amending the value, replace disabled with readonly.

Additionally, ensure that value="{{ $grantor->grantor_name }}" has a value.

Edit

I've just noticed you also have an additional nested form tag just before your grantor_name input. Don't nest form elements, so remove that.

Remove any form tags that are nested inside of your outer form tag. So basically any inside of

<form method="post" action="{{route('grantors.update', $grantor->id )}}" class="is-readonly">

The one I can see in your example is

<form class="w-full">

Which is just under your @endif and before your grantor_name input.

Then again do some debugging on $request->input() to check if there is a key/value pair for grantor_name.