mercredi 27 mai 2020

Laravel Pass value from foreach loop in controller to view

Hi guys can someone help please, i am trying to get the data from a foreach loop in my controller to pass to my view. How do I do it?

This is the controller

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Student;
use App\Result;
use App\Class_room;

class FormteachersController extends Controller
{
//

    public function form_teachers_view(){
        $UniqueStudent = Student::where('Student_ClassID','JSS 1C')->get();
        foreach ($UniqueStudent as $keydata) {
            $student = $keydata->Stud_id;
            $result= Result::where('Term_ID','1st Term')->where('Student_ID',$student)->where('Class_ID','JSS 1C')->where('Session_ID','2225/2222')->get();
            foreach ($result as $keyresult) {
                echo '<br>'.'<br>'.$student.'-'.$result;
            }
            return view('teachers.form_teachers_comment_sec');
        }
    }
}

This is the output currently by enter image description here



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

Aucun commentaire:

Enregistrer un commentaire