Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

stephen waweru's avatar

approval and disapproval system for a booking web app in laravel

am building a booking web app system whereby after a client sends a booking, the details of the booking are saved in the database.then one of the admins(whom I have assigned the role of a manager) approves the booking to another admin(whom I have assigned the role of an accountant). the manager can approve or cancel booking. i have assigned a boolean value of 0 for the pending approval 1 for the approve 2 for the reject

where am having a problem is on the first approval by the manager.i have added all the necessary code but still it doesn't approve or rather it shows an approval has been made but it doest change the values in the database.

here is my approval method in the controller

public function update(Request $request,$id) { $bookingstatus=Bookings::where('id',$request->id)->first(); if($bookingstatus->is_booking==0) { $bookingstatus->is_booking==1; $bookingstatus->save(); }

    return redirect()->back()->with('success','The Booking has successfully been Aprroved to the accountant');
}

here is the route

Route::post('/booking/changestatus/{id}', [Bookings_controller::class,'update'])->name('changestatus');

here is my approval form in the blade file

    @if(Session::has('success'))
       <p class="text-success">{{session('success')}}</p>
    @endif

    <form method="post" action="{{  route('changestatus',$booking->id)  }}">
        @csrf
        {{-- @method('PUT') --}}
        <div class="form-group">
            <label>Name</label>
            <input type="text" name="full_name" class="form-control disabled" readonly="" value="{{ $booking->full_name }}" id="name">
        </div>
        <div class="form-group">
            <label>Email</label>
            <input type="text" name="email" class="form-control disabled" readonly="" value="{{ $booking->email }}" id="email">
        </div> 
        <div class="form-group">
            <label>Location</label>
            <input type="text" name="location" class="form-control disabled" readonly="" value="{{ $booking->location }}" id="location">
        </div>
        <div class="form-group">
            <label>Date</label>
            <input type="text" name="date" class="form-control disabled" readonly="" value="{{ $booking->date }}" id="date">
        </div>
        <div class="form-group">
            <label>Phone Number</label>
            <input type="text" name="phone" class="form-control disabled" readonly="" value="{{ $booking->phone }}" id="phone">
        </div>
        <div class="form-group">
            <label>Event Type</label>
            <select name="eventcategory" class="form-control" id="FormControlSelect">
                @foreach($bookingcats as $bookingcat)
                    @if ($bookingcat->id==$booking->event_id)
                        <option type="text" readonly="" selected value="{{ $bookingcat->id }}">{{ $bookingcat->booking_category }}</option>
                    @endif
                @endforeach
            </select>

            <input type="hidden" name="is_booking" class="form-control disabled" readonly="" value="0">
            {{-- <input type="text" name="eventcategory" class="form-control disabled" readonly="" value="{{ $booking->bookingtyp->booking_category }}" id="eventtype"> --}}
        </div>
        <div class="form-group">
            <label>Event Details</label>
            <textarea id="event_details" name="event_details" readonly="" class="form-control">
                {{ $booking->event_details }}
            </textarea>
        </div>

        <button class="btn btn-dark" type="submit">
            @if($booking->is_booking==0)
            Approve to Accountant
            @else
            Unapprove the Booking
            @endif
            {{-- <a class="text-white" href="{{ url('admin/booking/changestatus/'.$booking->id) }}">
                
            </a> --}}
        </button>
    </form>
0 likes
0 replies

Please or to participate in this conversation.