vendredi 12 février 2021

timetable or lesson schedule in laravel

I am making a lesson schedule for students from the Schedule table:

id

group_id

teacher_id

time_id

weekday_id

chet_id

So, I need to display the schedule, and where there are no lessons, a link is displayed to add a schedule for that day and time. But, unfortunately, I can't display the schedule correctly. It turns out like this: enter image description here

Chet_id is responsible for the frequency of lessons (for example, chet_id = 1-lessons are held on even weeks, 2-odd weeks, 3-every week)

Here part of controller:

    public function showschedulestud(){
$weekdays=Weekday::all();
$chets=Chet::all();
                $group_id=Auth::user()->student->group_id;
            $schedule=Schedule::where('group_id', $group_id)->get();
            return view('schedule.showschedule', compact('schedule', 'weekdays', 'chets'));
        }

And view:

<table class="table table-dark">
     <tr>
        <th scope="col">#</th>
         @foreach($weekdays as $weekday)

        <th scope="col"></th>
             @endforeach
    </tr>
@foreach($times as $time)
        @foreach($chets as $chet)
    <tr>
        <th scope="row">-</th>
        <th scope="row"></th>
        @foreach($schedule as $sched)
            @if($sched->weekday_id=$weekday->id && $sched->time_id=$time->id && $sched->chet=$chet->id)
        <td></td>
            @else
                <td>/createschedule//</td>
            @endif
            @endforeach
            </tr>
            @endforeach
    @endforeach
       </table>

I would be grateful if you can help me somehow solve a problem that has been tormenting me for a long time.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3b2RpXJ
via IFTTT

Aucun commentaire:

Enregistrer un commentaire