Simplify transformer logic
This commit is contained in:
parent
f7fc67344e
commit
33bafe9277
6 changed files with 32 additions and 44 deletions
|
@ -58,17 +58,11 @@ class DisplayException extends PterodactylException
|
|||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
*
|
||||
* @return \Illuminate\Http\JsonResponse|\Illuminate\Http\RedirectResponse
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function render($request)
|
||||
{
|
||||
if ($request->expectsJson()) {
|
||||
return response()->json(Handler::convertToArray($this, [
|
||||
'detail' => $this->getMessage(),
|
||||
]), method_exists($this, 'getStatusCode') ? $this->getStatusCode() : Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
Container::getInstance()->make(AlertsMessageBag::class)->danger($this->getMessage())->flash();
|
||||
app(AlertsMessageBag::class)->danger($this->getMessage())->flash();
|
||||
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
|
|
Reference in a new issue