Ejemplo n.º 1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     if (Setting::getSettings()->alert_email != '' && Setting::getSettings()->alerts_enabled == 1) {
         $data['data'] = Helper::checkLowInventory();
         $data['count'] = count($data['data']);
         if (count($data['data']) > 0) {
             \Mail::send('emails.low-inventory', $data, function ($m) {
                 $m->to(explode(',', Setting::getSettings()->alert_email), Setting::getSettings()->site_name);
                 $m->subject('Low Inventory Report');
             });
         }
     } else {
         if (Setting::getSettings()->alert_email == '') {
             echo "Could not send email. No alert email configured in settings. \n";
         } elseif (Setting::getSettings()->alerts_enabled != 1) {
             echo "Alerts are disabled in the settings. No mail will be sent. \n";
         }
     }
 }
Ejemplo n.º 2
0
                       @endcan
                       @can('components.create')
                       <li {!! (Request::is('admin/components/create') ? 'class="active"' : '') !!}>
                           <a href="{{ route('create/component') }}">
                           <i class="fa fa-hdd-o"></i>
                           @lang('general.component')</a>
                       </li>
                       @endcan
                   </ul>
               </li>
               @endcan

               @can('admin')
               <!-- Tasks: style can be found in dropdown.less -->
               <?php 
$alert_items = \App\Helpers\Helper::checkLowInventory();
?>

               <li class="dropdown tasks-menu">
                 <a href="#" class="dropdown-toggle" data-toggle="dropdown">
                   <i class="fa fa-flag-o"></i>
                   @if (count($alert_items))
                    <span class="label label-danger">{{ count($alert_items) }}</span>
                   @endif
                 </a>
                 <ul class="dropdown-menu">
                   <li class="header">You have {{ count($alert_items) }} items below or almost below minimum quantity levels</li>
                   <li>
                     <!-- inner menu: contains the actual data -->
                     <ul class="menu">