IMMREX7

aku nok ndi : /home/spdtg/www/schoolmis/app/Http/Controllers/School/Exam/
File Up :
aku nok ndi : /home/spdtg/www/schoolmis/app/Http/Controllers/School/Exam/ExamExportController.php

<?php

namespace App\Http\Controllers\School\Exam;

use Illuminate\Http\Request;
use App\Http\Controllers\School\SchoolController;
use DB;
use Auth;

class ExamExportController extends SchoolController {

    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index() {
        $classes = ['' => '--Select--'] + \App\ClassM::where('idSchool', '=', Auth::guard('school')->user()->idSchool)
                        ->orderBy('idClass')->get()->pluck('className', 'idClass')->toArray();
        $select =  ['' => '--Select--'];     
       return view('schools.exams.exam_export', compact('classes','select'));
    }

    /**
     * Show the form for creating a new resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function create() {
        //
    }

    /**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
    public function store(Request $request) {
        $idStudent = array();
        foreach($request->students as $key => $value){
            array_push($idStudent,$value);
        }
       
        $students = \App\AdmEntry::where('idSchool', '=', Auth::guard('school')->user()->idSchool)
                ->whereIn('idStudent', $idStudent)
                ->orderBy('idStudent')->get();
                
        $idStudent = array();       
        foreach($students as $value){
            
           array_push($idStudent,array(
               $value->admissionNo,
               $value->ecNo,
               $value->firstName." ".$value->middleName." ".$value->lastName,
               $value->classM->className,
               $value->section->sectionName,
               $value->contactPersonMobile,
               $value->gender,
               $value->studentDob,
               $value->father_fname." ".$value->father_lname,
               $value->mother_fname." ".$value->mother_lname
               ));
        }
         
        return json_encode($idStudent);
    }

    /**
     * array_push($idStudent,array(
               "Admission No" => $value->admissionNo,
                "Ec No" =>$value->ecNo,
                "Full Name" => $value->firstName." ".$value->middleName." ".$value->lastName,
                "Class" =>$value->classM->className,
                "Section" =>$value->section->sectionName,
                "Gender" =>$value->gender,
                "DOB" =>$value->studentDob,
                "Contact Number" =>$value->contactPersonMobile,
                "Fathers Name" =>$value->father_fname." ".$value->father_lname,
                "Mothers Name" =>$value->mother_fname." ".$value->mother_lname
               ));
     * Display the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function show($id) {
        //
    }

    /**
     * Show the form for editing the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function edit($id) {
       //
    }

    /**
     * Update the specified resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function update(Request $request, $id) {
        //
    }

    /**
     * Remove the specified resource from storage.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
    public function destroy($id) {
        //
    }

}

Copyright © 2021 - 2025 IMMREX7