<?php

namespace App\Http\Controllers\front;

use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Validator;
use File;
use Image;
use DB;

class HomePageController extends Controller
{
    //
    public function Index(){

        return view('front/index');
    }

    public function ShowReports(Request $request){

        $patient_name = $request->name;
        $registration_no = $request->registration_no;
        $reports_data = DB::table('reports')->where('status',1);

        if(!empty($patient_name)){
            $reports_data->where('name','LIKE', '%'.$patient_name.'%');
        }
        if(!empty($registration_no)){
            $reports_data->where('registration_no',$registration_no);
        }
        $FinalReportData = $reports_data->get();
        return view('front/index',compact('FinalReportData'));

    }

}
