Added helper for dept list

This commit is contained in:
snipe 2017-05-23 02:37:37 -07:00
parent 64f17cecbf
commit a7592de304

View file

@ -4,6 +4,7 @@ namespace App\Helpers;
use DB; use DB;
use App\Models\Statuslabel; use App\Models\Statuslabel;
use App\Models\Location; use App\Models\Location;
use App\Models\Department;
use App\Models\AssetModel; use App\Models\AssetModel;
use App\Models\Company; use App\Models\Company;
use App\Models\User; use App\Models\User;
@ -184,6 +185,25 @@ class Helper
return $category_list; return $category_list;
} }
/**
* Get the list of categories in an array to make a dropdown menu
*
* @author [A. Gianotto] [<snipe@snipe.net>]
* @since [v2.5]
* @return Array
*/
public static function departmentList()
{
$departments = Department::orderBy('name', 'asc')
->whereNull('deleted_at')
->orderBy('name', 'asc');
return array('' => trans('general.select_department')) + $departments->pluck('name', 'id')->toArray();
}
/** /**
* Get the list of suppliers in an array to make a dropdown menu * Get the list of suppliers in an array to make a dropdown menu
* *