File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
app/Http/Controllers/Assets Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -358,15 +358,19 @@ public function update(Request $request) : RedirectResponse
358358 * to someone/something.
359359 */
360360 if ($ request ->filled ('status_id ' )) {
361- $ updated_status = Statuslabel::find ($ request ->input ('status_id ' ));
361+ try {
362+ $ updated_status = Statuslabel::findOrFail ($ request ->input ('status_id ' ));
363+ } catch (ModelNotFoundException $ e ) {
364+ return redirect ($ bulk_back_url )->with ('error ' , trans ('admin/statuslabels/message.does_not_exist ' ));
365+ }
362366
363367 // We cannot assign a non-deployable status type if the asset is already assigned.
364368 // This could probably be added to a form request.
365369 // If the asset isn't assigned, we don't care what the status is.
366370 // Otherwise we need to make sure the status type is still a deployable one.
367371 if (
368372 ($ asset ->assigned_to == '' )
369- || ($ updated_status ->deployable == '1 ' ) && ($ asset ->assetstatus ->deployable == '1 ' )
373+ || ($ updated_status ->deployable == '1 ' ) && ($ asset ->assetstatus ? ->deployable == '1 ' )
370374 ) {
371375 $ this ->update_array ['status_id ' ] = $ updated_status ->id ;
372376 }
You can’t perform that action at this time.
0 commit comments