@extends('layouts.dashboard') @section('content') <h1 class="page-header">Dashboard</h1> <?php $id = Auth::User()->id; $role = DB::table('assigned_roles')->where('user_id', $id)->first(); ?> <?php $purchaseRequest = Purchase::all(); $prCount = 0; $POCount = 0; $chequeCount = 0; $reports = Reports::all(); foreach ($reports as $report) { $POCount = $POCount + $report->pOrderCount; $chequeCount = $chequeCount + $report->chequeCount; } $attachment = Attachments::where('saved', '0')->get(); foreach ($attachment as $attachments) { $destine = public_path() . "/uploads/" . $attachments->data; $attachments->delete(); unlink($destine); } ?> @if($role->role_id!=1) <!-- Prints total number of purchase requests received --> <div class="col-md-4">
public function viewSummary() { $prCount = 0; $POCount = 0; $chequeCount = 0; $reports = Reports::all(); foreach ($reports as $report) { $prCount = $prCount + $report->pRequestCount; $POCount = $POCount + $report->pOrderCount; $chequeCount = $chequeCount + $report->chequeCount; } return View::make('purchaseRequest.summary')->with('prCount', $prCount)->with('POCount', $POCount)->with('chequeCount', $chequeCount); }