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);
 }
 public function getIndex()
 {
     //Get the items from the StoreDB
     $store_items = Item::whereRaw("loadout_slot IN ( 'brillen','hats','pets','skin','snorren','piemol','vogel','jetpack' )")->get();
     //Sort them
     $store_items = $store_items->sortBy(function ($store_item) {
         return $store_item->loadout_slot;
         //sort them by loadout slot
     });
     $paymentprovider = DB::table('sd_payment_providers')->orderBy('pos', 'desc')->get();
     $user = Sentinel::check();
     $sd_items = SDItem::where('visible', '1')->get();
     //Build the view
     return View::make('item.overview', array('items' => $store_items, 'sditems' => $sd_items, 'payment_providers' => $paymentprovider, 'user' => $user));
 }
Example #3
0
            });
          });
        </script>

<div id="page-wrapper">
  <div class="row">
      <div class="col-md-12"  id="div-warning" class="" style='position:fixed;display:none;right:0;z-index:9999;'>
        <div class="alert alert-danger">
          <table class="table table-hover" width=80%>
            <thead>
              <th>ID</th>
              <th>Model_number</th>
              <th>Total Quantity</th>
            </thead>
          <?php 
$itemWarning = Item::whereRaw('total_quantity <= alert_quantity')->get();
foreach ($itemWarning as $key => $value) {
    echo '<tr>';
    echo '<td>' . $value['id'] . '</td>';
    echo '<td>' . $value['model_number'] . '</td>';
    echo '<td>' . $value['total_quantity'] . '</td>';
    echo '</tr>';
}
?>
          </table>
        </div>

      </div>
    </div>
	<div id="page-inner">