<?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">
        <div class="panel panel-success">
            <div class="panel-heading">
                <div class="row">
                    <div class="col-xs-6">
                        <div>
 public function cancelcreate()
 {
     Attachments::where('saved', '0')->delete();
     return Redirect::to("purchaseRequest/view");
 }