IMMREX7
<?php
namespace App\Http\Controllers\School\Library;
use Illuminate\Http\Request;
use App\Http\Controllers\School\SchoolController;
use Auth;
use DB;
use PDF;
class BarcodeController extends SchoolController {
/**
* Display a listing of the resource.
*
* @return \Illuminate\Http\Response
*/
public function index(Request $request) {
$students = [];
$books = [];
$employees = [];
if ($request->type == 'book') {
$books = \App\Book::where('idSchool', '=', Auth::guard('school')->user()->idSchool)
->get();
} elseif ($request->type == 'student') {
$students = DB::table('students')
->join('classes', 'students.idClass', '=', 'classes.idClass')
->join('sections', 'students.idSection', '=', 'sections.idSection')
->where('students.idSchool', '=', Auth::guard('school')->user()->idSchool)
->select('ecNo','idStudent','father_mobile','className','sectionName','father_fname','father_lname','firstName','middleName','lastName')
->get();
} elseif ($request->type == 'employee') {
$employees = DB::table('employees')
->join('departments', 'employees.idDepartment', '=', 'departments.idDepartment')
->join('designations', 'employees.idDesignation', '=', 'designations.idDesignation')
->where('employees.idSchool', '=', Auth::guard('school')->user()->idSchool)
->get();
}
return view('schools.library.generate_barcode', compact('students', 'books', 'employees'));
}
/**
* 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) {
// dd($request->all());
// ini_set("pcre.backtrack_limit", "1000000");
$school = \App\School::where('idSchool','=',Auth::guard('school')->user()->idSchool)->first();
$data = $request->students;
$column = $request->columnNo;
$skip = $request->skip;
$pdf = PDF::loadView('schools.library.print_barcode', ['margin_top' => 20], compact('column', 'school', 'data','skip'));
return $pdf->stream('barcode.pdf');
//return view('schools.library.print_barcode', compact('column','data','school','skip'));
}
/**
* 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 -