public function edit()
 {
     //Larasset::start('footer')->js('bootstrap-datepicker');
     //Larasset::start('header')->css('bootstrap-datepicker');
     $all = Input::all();
     $id = $all['id'];
     //Lets fetch the updated data and return it through ajax
     $data['row'] = Vendor::where('id', $id)->get()->toArray()[0];
     return View::make('admin.vendor.vendor_edit', $data);
 }
 public function sendEmail()
 {
     //get all items that are low
     $items = Item::whereRaw('quantity <= email_threshold')->where('active', '=', 1)->get();
     //mails to Coordinators
     $to = implode(', ', DB::table('users')->where('positions_id', '=', 6)->lists('email'));
     //Declares the subject for the email
     $subject = "Low Inventory Update";
     //"From:"" Header
     $headers = 'From: Inventory Updater' . "\r\n";
     //first two lines of the message
     $message = "-Automated message from Inventory Control System-\r\nThe following items need to be ordered:\r\n\r\n\r\n";
     //for each item, it formats the output and adds it to the message
     foreach ($items as $item) {
         $vendorId = Vendor::where('id', '=', $item->vendor_id)->pluck('name');
         $message .= $item->name . " | On-Hand: " . $item->quantity . "\r\n";
         $message .= "Email Threshold set for order prompt at " . $item->email_threshold . " remaining.\r\n";
         $message .= "Order from " . $vendorId . " at " . $item->item_url . "\r\n\r\n";
     }
     //adds the final lines to message.
     $message .= "\r\nThe inventory site can be reached at: https://loftythoughts.me/caeweb/inventory/ \r\n";
     $signature = "\r\n\r\nCAE Center";
     $message .= $signature;
     //sends the email
     mail($to, $subject, $message, $headers);
 }