I want to give function to both approve and decline button that is in admin dashboard and display the result as remarks:pending/accepted/decline in user's dashboard.
here is my admin view
dashboard.php.blade
<table class="table table-bordered" id="dataTable" width="100%" cellspacing="0">
<thead>
<tr>
<th hidden>Id</th>
<th>Name</th>
<th>Equipment</th>
<th>Reservation Date</th>
<th>Rooms</th>
<th>Action</th>
</tr>
</thead>
<tbody>
@foreach ($res as $resdata)
<tr>
<td hidden> </td>
<td>{{$resdata->name}} </td>
<td>{{$resdata->Name_item}}</td>
<td>{{$resdata->dt_item}}</td>
<td>{{$resdata->room_item}} </td>
<td>
<button type="button" class="btn btn-primary btn-sm" >Accept <i class="fas fa-chevron-right"></i></button></a>
<button type="button" class="btn btn-danger btn-sm">Decline <i class="fas fa-times"></i></button>
</td>
</tr>
@endforeach
</tbody>
</table>
refer to this photo enter image description here
And when I click the accept button it will go to the accepted reservation table please refer here enter image description here
<form action="{{route(YourRoute/{id})}}"
<button type="submit" class="btn btn-primary btn-sm" >Accept <i class="fas fa-chevron-right"></i></button></a>
</form>
In Your Controller
public function ($id){
$reservation = Reservation::find($id);
$reservation->status = true ;
return redirect()->back()->with('message' , 'Success');
}
public function index (){
$reservation = Reservation::where('status' , true);
return view()->with('reservations' , $reservation);
}