Skip to content

Commit

Permalink
fix invalid urls
Browse files Browse the repository at this point in the history
  • Loading branch information
dbarzin committed Oct 31, 2023
1 parent 91492f9 commit 76f8c28
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
9 changes: 6 additions & 3 deletions app/Http/Controllers/MeasureController.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ public function update(Request $request, Measure $measure)
]
);

// not found
abort_if($measure === null, Response::HTTP_NOT_FOUND, '404 Not Found');

// update measure
$measure->domain_id = request('domain_id');
$measure->name = request('name');
Expand Down Expand Up @@ -244,7 +247,7 @@ public function update(Request $request, Measure $measure)
}

// retun to view measure
return redirect('/measures/'.$measure->id);
return redirect('/alice/show/'.$measure->id);
}

/**
Expand Down Expand Up @@ -363,7 +366,7 @@ public function activate(Request $request)
}

// return to the list of measures
return redirect('/measures');
return redirect('/alice/index');
}

/**
Expand Down Expand Up @@ -392,7 +395,7 @@ public function disable(Request $request)
}

// return to the list of measures
return redirect('/measures');
return redirect('/alice/index');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion resources/views/measures/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</div>
@endif

<form method="POST" action="/alice/{{ $measure->id }}">
<form method="POST" action="/alice/save/{{ $measure->id }}">
@method("PATCH")
@csrf
<div class="grid">
Expand Down
1 change: 1 addition & 0 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
Route::get('/alice/index', 'MeasureController@index');
Route::get('/alice/create', 'MeasureController@create');
Route::post('/alice/store', 'MeasureController@store');
Route::patch('/alice/save/{id}', 'MeasureController@update');
Route::get('/alice/{id}/edit', 'MeasureController@edit');
Route::get('/alice/plan/{id}', 'MeasureController@plan');
Route::get('/alice/show/{id}', 'MeasureController@show');
Expand Down

0 comments on commit 76f8c28

Please sign in to comment.