Merge branch 'develop'

This commit is contained in:
snipe 2017-11-01 13:28:19 -07:00
commit d379c6b61f
2 changed files with 11 additions and 8 deletions

View file

@ -161,20 +161,23 @@ class StatuslabelsController extends Controller
public function getAssetCountByStatuslabel() public function getAssetCountByStatuslabel()
{ {
$statusLabels = Statuslabel::get(); $statuslabels = Statuslabel::with('assets')->groupBy('id')->withCount('assets')->get();
$labels=[]; $labels=[];
$points=[]; $points=[];
$colors=[]; $colors=[];
foreach ($statusLabels as $statusLabel) { foreach ($statuslabels as $statuslabel) {
if ($statusLabel->assets()->count() > 0) { if ($statuslabel->assets_count > 0) {
$labels[]=$statusLabel->name;
$points[]=$statusLabel->assets()->whereNull('assigned_to')->count(); $labels[]=$statuslabel->name. ' ('.number_format($statuslabel->assets_count).')';
if ($statusLabel->color!='') { $points[]=$statuslabel->assets_count;
$colors[]=$statusLabel->color; if ($statuslabel->color!='') {
$colors[]=$statuslabel->color;
} }
} }
} }
$colors_array = array_merge($colors, Helper::chartColors()); $colors_array = array_merge($colors, Helper::chartColors());
$result= [ $result= [

View file

@ -142,7 +142,7 @@ class ManufacturersController extends Controller
$image = $request->file('image'); $image = $request->file('image');
$file_name = str_slug($image->getClientOriginalName()).".".$image->getClientOriginalExtension(); $file_name = str_slug($image->getClientOriginalName()).".".$image->getClientOriginalExtension();
$path = public_path('uploads/manufacturers/'.$file_name); $path = public_path('uploads/manufacturers/'.$file_name);
$old_image = $path.$model->image; $old_image = $path.$manufacturer->image;
try { try {
unlink($old_image); unlink($old_image);