I have a table and inside the table i have textbox here take a look for the Page.
now the problem is whenever i update specific row or id, then it updates everything. how can i just update the sepecific row or id without updating everything? thank you verymuch
here is my controller
public function updateSchedule(Request $request, $id)
{
$timein = $request->input('timeIn');
$timeout = $request->input('timeOut');
DB::table('schedules')
->update(['time_in' => $timein, 'time_out' => $timeout]);
$notification = array(
'message' => 'Employee Time Updated!',
'alert-type' => 'success'
);
return redirect()->back()->with($notification, 'Employee Time Updated!');
}
and here is my view
{!! Form::open(['action' => ['Admin\EmployeeFilemController@updateSchedule', $employee->id], 'method' => 'POST']) !!}
<div class="row">
<div class="form-group col-md-12">
<small>Employee No. and Name: </small><b><i> : , </i></b>
<input type="hidden" name="hidEmployeeno" value='<?php echo $employee->employee_no ?>'>
<input type="hidden" name="hidEmployeeLast" value='<?php echo $employee->last_name ?>'>
<input type="hidden" name="hidEmployeeFirst" value='<?php echo $employee->first_name ?>'>
<hr>
</div>
</div>
<table class="table">
<thead>
<tr>
<th>DATE</th>
<th>TIME IN</th>
<th>LUNCH</th>
<th>TIME OUT</th>
<th>TOTAL HOURS</th>
<th>STATUS</th>
</tr>
</thead>
<tbody>
@foreach ($employeeSched as $setTime)
<tr>
<td> </td>
<td><input type="time" name="timeIn" class="form-control col-md-10" value=''></td>
<td><p>12:00 PM - 1:00 PM</p></td>
<td><input type="time" name="timeOut" class="form-control col-md-10" value=''></td>
<td>@php
$time1 = strtotime($setTime->time_in);
$time2 = strtotime($setTime->time_out);
$difference = round(abs($time2 - $time1) / 3600,2);
$total = $difference - 1;
echo '<b>' . $total . '</b>';
@endphp</td>
<td>
@php
if ($total < 8) {
echo '<b>Late</b>';
} else if($total > 8) {
echo '<b>OT</b>';
} elseif ($total < 8.5 && $total == 8) {
echo '<b>In</b>';
}
@endphp
</td>
</tr>
@endforeach
</tbody>
</table>
{!! Form::close() !!}
thank you kind help me please thanks
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire