v0.10.0c - Fixed WashingMachine create & update AJAX
This commit is contained in:
@@ -70,7 +70,7 @@ class WashingMachineController extends Controller
|
||||
|
||||
// If there already is a washing machine with that name, then don't add it
|
||||
if (count($allMachines) > 0)
|
||||
return redirect()->route("washing-machines.store")->with('WashingNameExists', '<p><b>Der findes allerede en vaskemaskine med det navn!</b></p>');
|
||||
return redirect()->route("washing-machines.store");
|
||||
else { // Else - Add it
|
||||
$machine->save();
|
||||
$machines = WashingMachine::query()->paginate($request->input("limit", 20));
|
||||
@@ -127,7 +127,7 @@ class WashingMachineController extends Controller
|
||||
|
||||
// If there already is a washing machine with that name, then don't change it
|
||||
if (count($allMachines) > 0)
|
||||
return redirect()->route("washing-machines.store")->with('WashingNameExists', '<p><b>Der findes allerede en vaskemaskine med det navn!</b></p>');
|
||||
return redirect()->route("washing-machines.store");
|
||||
else { // Else - Change the name
|
||||
$machine->update($data);
|
||||
$machine->save();
|
||||
@@ -154,14 +154,17 @@ class WashingMachineController extends Controller
|
||||
return redirect()->route("washing-machines.index");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public function nameCheck(Request $request){
|
||||
$washing = WashingMachine::query()->where('name', 'LIKE',$request->nameCheck)->get();
|
||||
$washing = WashingMachine::query()->where('name', 'LIKE',$request->nameCheck)->where('location_id', '=', $request->location)->get();
|
||||
if(count($washing) > 0 && $request->nameCheck !== NULL){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
public function nameCheckUpdate(Request $request){
|
||||
$washing = WashingMachine::query()->where('name', 'LIKE',$request->nameCheck)->where('location_id', '=', $request->location)->where('id', '!=', $request->id)->get();
|
||||
if(count($washing) > 0 && $request->nameCheck !== NULL){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user