/**
  * Display the specified resource.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function show($id)
 {
     //
     $company = Company::find($id);
     $branches = Branch::where("company_id", "=", $company->id)->get();
     $stacks = Invoicingstack::where("company_id", "=", $company->id)->where("status", "=", 0)->get();
     $stack2s = Invoicingstack::where("company_id", "=", $company->id)->get();
     $invoice = Bill::where("company_id", "=", $company->id)->get();
     $invoiceGroup = Bill::where("company_id", "=", $company->id)->groupBy("invoice_date")->get();
     return View("company.companydetail", ['invGp' => $invoiceGroup, 'stacks' => $stacks, 'stack2s' => $stack2s, 'invoices' => $invoice, 'company' => $company, 'branches' => $branches, 'title' => 'Company Detail']);
 }
 public function updateStack(Request $request, $id)
 {
     $mstack = Invoicingstack::find($id);
     $mstack->status = $request->input('mstatus');
     if ($mstack->update()) {
         echo "Status Successfully Changed";
     }
 }
        <?php 
if ($invoices) {
    foreach ($invGp as $inv) {
        echo "<li class='time-label'>\n                        <span class='bg-red'>" . date_format(date_create($inv->invoice_date), "d M. Y") . "</span>\n                    </li>";
        foreach ($invoices as $invoice) {
            if ($inv->invoice_date == $invoice->invoice_date) {
                echo " <li>\n                            <i class='fa fa-file-text bg-blue'></i>\n                            <div class='timeline-item'>\n                                <span class='time'><i class='fa fa-clock-o'></i>" . date_format(date_create($invoice->created_at), "H:i ") . "</span>\n                                <h3 class='timeline-header'><a href='#'>Invoice</a> generated for " . $invoice->duration . "</h3>\n                                <div class='timeline-body'>";
                echo " <div class='row'>\n                        <!-- accepted payments column -->\n                        <div class='col-xs-6'>\n                            <p><h3>Invoice ID: {$invoice->invoice_no}</h3></p>\n                            <p>Generated to {$company->name}</p>\n                        </div><!-- /.col -->\n                        <div class='col-xs-6'>\n                           <!-- <p class='lead'>Amount Due 2/22/2014</p>-->\n                            <div class='table-responsive'>\n                                <table class='table'>\n                                    <tr>\n                                        <th style='width:50%'>Subtotal:</th>\n                                        <td>₦" . number_format($invoice->subtotal, 2, '.', ',') . "</td>\n                                    </tr>\n                                    <tr>\n                                        <th style='width:50%'>5% VAT:</th>\n                                        <td>₦" . number_format($invoice->tax, 2, '.', ',') . "</td>\n                                    </tr>\n                                    <tr>\n                                        <th>Total:</th>\n                                        <td>₦" . number_format($invoice->total, 2, '.', ',') . "</td>\n                                    </tr>\n                                </table>\n                            </div>\n                        </div>";
                echo "</div>\n                                <div class='timeline-footer'>";
                ?>

                                    <a href='{{url()}}/invoicexlxs/{{$invoice->file_url}}'  class='btn bg-green btn-xs'><i class='fa fa-download'></i> Download Report</a>

                                    <?php 
                echo "<a href='" . url() . "/invoicing/print/" . $invoice->id . "' target='_blank' class='btn btn-primary btn-xs'> <i class='fa fa-file-o'></i> View Invoice</a>\n                                    <a class='delLink btn btn-danger btn-xs btn-inv-del' dname='{$invoice->duration}' url='/invoicing/deleteinvoice/{$invoice->id}'  data-target='#myDelete' data-toggle='modal'><i class='fa fa-trash'></i> Delete</a>\n                                </div>\n                            </div>\n                        </li>";
                $invoiceStack = \App\Invoicingstack::where("company_id", "=", $invoice->company_id)->where("created_at", "=", $invoice->created_at)->get();
                foreach ($invoiceStack as $stack) {
                    if (date_format(date_create($inv->invoice_date), "M") == date_format(date_create($stack->created_at), "M")) {
                        echo "<li>\n                                    <i class='fa fa-upload bg-green'></i>\n                                    <div class='timeline-item'>\n                                        <span class='time'><i class='fa fa-clock-o'></i>" . date_format(date_create($stack->created_at), "H:i") . "</span>\n                                        <h3 class='timeline-header'><a href='#'>File Uploaded For </a>";
                        echo \App\Branch::where("id", $stack->site_id)->pluck("name");
                        echo "</h3>\n                                        <div class='timeline-body'>\n                                             <a href=''><i class='fa  fa-file-excel-o'></i> {$stack->file_url}</a>\n                                        </div>\n                                    </div>\n                                </li>";
                    }
                }
            }
        }
    }
}
?>

    </ul>
</div><!-- /.tab-pane -->