Laravel - Insert Array of data into database

Hello how can I achieve to insert data on an array? using eloquent? right now i have this on my

Controller

public function insertSchedule(Request $request)
{
    $employAdd = [];
foreach($employAdd as $key){

    $employeeTimeSet = new Schedule;
    $employeeTimeSet->employee_no = $request->input('hidEmployeeno'); 
    $employeeTimeSet->last_name = $request->input('hidEmployeeLast'); 
    $employeeTimeSet->first_name = $request->input('hidEmployeeFirst'); 
    $employeeTimeSet->date_today = $request->input('dateToday'); 
    $employeeTimeSet->time_in = $request->input('timeIn'); 
    $employeeTimeSet->time_out = $request->input('timeOut'); 
    $employeeTimeSet->save();    

}

}

View

See here my view? the dates here are arrays then when I insert this into the database the output or the data that is being inserted is the last data why is that?

         {!! Form::open([‘action’ => ‘Admin\EmployeeFilemController@insertSchedule’, ‘method’ => ‘POST’]) !!}
<div class=“row”>
<div class=“form-group col-md-12”>

                &lt;small&gt;Employee No. and Name: &lt;/small&gt;&lt;b&gt;&lt;i&gt; {{ $employee-&gt;employee_no }} : {{ $employee-&gt;last_name }}, {{ $employee-&gt;first_name }}&lt;/i&gt;&lt;/b&gt;

                &lt;input type="hidden" name="hidEmployeeno[]" value='&lt;?php echo $employee-&gt;employee_no ?&gt;'&gt;
                &lt;input type="hidden" name="hidEmployeeLast[]" value='&lt;?php echo $employee-&gt;last_name ?&gt;'&gt;
                &lt;input type="hidden" name="hidEmployeeFirst[]" value='&lt;?php echo $employee-&gt;first_name ?&gt;'&gt;
                &lt;hr&gt;

            &lt;/div&gt;

    &lt;/div&gt;


    @php
    $today = today(); 
    $dates = []; 

    for($i=1; $i &lt; $today-&gt;daysInMonth + 1; ++$i) {
        $dates[] = \Carbon\Carbon::createFromDate($today-&gt;year, $today-&gt;month, $i)-&gt;format('F-d-Y');
    }
@endphp

&lt;table class="table"&gt;
    &lt;thead&gt;
        &lt;tr&gt;
        &lt;th&gt;DATE TODAY&lt;/th&gt;
        &lt;th&gt;TIME IN&lt;/th&gt;
        &lt;th&gt;TIME OUT&lt;/th&gt;
        &lt;th&gt;ACTION&lt;/th&gt;
        &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody&gt;
        @foreach($dates as $date)


#php #laravel

7 Likes248.65 GEEK