v1.1.0 - Washing machines and locations is on the same pages now, made bruger roles immortal so you cant delete it or edit it
This commit is contained in:
@@ -64,11 +64,11 @@ class LocationController extends Controller
|
||||
|
||||
// If there already is a washing machine with that name, then don't add it
|
||||
if (count($locations) > 0)
|
||||
return redirect()->route("locations.index");
|
||||
return redirect()->route("washing-machines.index");
|
||||
else { // Else - Add it
|
||||
$location->save();
|
||||
$locations = Location::query()->paginate(20);
|
||||
return redirect()->route("locations.index", ['locations' => $locations]);
|
||||
return redirect()->route("washing-machines.index", ['locations' => $locations]);//washing-machines.index kan byttes ud med locations.index
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,13 +114,13 @@ class LocationController extends Controller
|
||||
|
||||
// If there already is a washing machine with that name, then don't change it
|
||||
if (count($allMachines) > 0)
|
||||
return redirect()->route("locations.index");
|
||||
return redirect()->route("washing-machines.index");
|
||||
else { // Else - Change the name
|
||||
$location->update($data);
|
||||
$location->save();
|
||||
|
||||
$locations = Location::query()->paginate(20);
|
||||
return redirect()->route("locations.index", ["locations" => $locations]);
|
||||
return redirect()->route("washing-machines.index", ["locations" => $locations]); //washing-machines.index kan byttes ud med locations.index
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ class LocationController extends Controller
|
||||
|
||||
$location->delete();
|
||||
|
||||
return redirect()->route("locations.index");
|
||||
return redirect()->route("washing-machines.index");//washing-machines.index kan byttes ud med locations.index
|
||||
}
|
||||
|
||||
public function nameCheck(Request $request){
|
||||
|
||||
@@ -29,7 +29,7 @@ class RolesController extends Controller
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$roles = Role::query()->where("id", "!=", 1)->paginate(20);
|
||||
$roles = Role::query()->where("id", "!=", 1)->where("id", "!=", 2)->paginate(20);
|
||||
|
||||
return Response::detect("roles.index", [ "roles" => $roles]);
|
||||
}
|
||||
@@ -104,7 +104,7 @@ class RolesController extends Controller
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
if($id == 1)
|
||||
if($id == 1 || $id == 2)
|
||||
return redirect()->route("roles.index");
|
||||
|
||||
$role = Role::find($id);
|
||||
@@ -120,7 +120,7 @@ class RolesController extends Controller
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
if($id == 1)
|
||||
if($id == 1 || $id == 2)
|
||||
return redirect()->route("roles.index");
|
||||
|
||||
$data = $request->validate([
|
||||
@@ -170,7 +170,7 @@ class RolesController extends Controller
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
if($id == 1)
|
||||
if($id == 1 || $id == 2)
|
||||
return redirect()->route("roles.index");
|
||||
|
||||
$role = Role::find($id);
|
||||
@@ -187,7 +187,7 @@ class RolesController extends Controller
|
||||
"<th style=\"width: 1em;\"><img class=\"w-100\" src=".asset('/images/icons/pencil.svg')." alt=\"Update\"></th>".
|
||||
"<th style=\"width: 1em;\"><img class=\"w-100\" src=".asset('/images/icons/trashcan.svg')." alt=\"Delete\"></th>".
|
||||
"</tr>";
|
||||
$roles = DB::table('roles')->where("id", "!=", 1)->where('name', 'LIKE',$request->search.'%')->get();
|
||||
$roles = DB::table('roles')->where("id", "!=", 1)->where("id", "!=", 2)->where('name', 'LIKE',$request->search.'%')->get();
|
||||
|
||||
if(count($roles) !== 0){
|
||||
foreach ($roles as $key => $role){
|
||||
|
||||
Reference in New Issue
Block a user