mirror of
https://github.com/snipe/snipe-it.git
synced 2026-04-29 03:05:25 +00:00
Refactor controller to use one method that shows all modals based on name.
This commit is contained in:
@ -6,47 +6,15 @@ use App\Helpers\Helper;
|
||||
|
||||
class ModalController extends Controller
|
||||
{
|
||||
function location() {
|
||||
return view('modals.location');
|
||||
}
|
||||
function show($type, $itemId = null) {
|
||||
$view = view("modals.${type}");
|
||||
|
||||
function model() {
|
||||
return view('modals.model');
|
||||
}
|
||||
|
||||
function statuslabel() {
|
||||
return view('modals.statuslabel')->with('statuslabel_types', Helper::statusTypeList());
|
||||
}
|
||||
|
||||
function supplier() {
|
||||
return view('modals.supplier');
|
||||
}
|
||||
|
||||
function user() {
|
||||
return view('modals.user');
|
||||
}
|
||||
|
||||
function category() {
|
||||
return view('modals.category');
|
||||
}
|
||||
|
||||
function manufacturer() {
|
||||
return view('modals.manufacturer');
|
||||
}
|
||||
|
||||
function kitModel() {
|
||||
return view('modals.kit-model');
|
||||
}
|
||||
|
||||
function kitLicense() {
|
||||
return view('modals.kit-license');
|
||||
}
|
||||
|
||||
function kitConsumable() {
|
||||
return view('modals.kit-consumable');
|
||||
}
|
||||
|
||||
function kitAccessory() {
|
||||
return view('modals.kit-accessory');
|
||||
if($type == "statuslabel") {
|
||||
$view->with('statuslabel_types', Helper::statusTypeList());
|
||||
}
|
||||
if(in_array($type, ['kit-model', 'kit-license', 'kit-consumable', 'kit-accessory'])) {
|
||||
$view->with('kitId', $itemId);
|
||||
}
|
||||
return $view;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user