mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-07-28 17:02:04 +03:00
Moved NotifyException render work from handler to exception
As continued from last commit.
This commit is contained in:
@ -1,8 +1,10 @@
|
||||
<?php namespace BookStack\Exceptions;
|
||||
|
||||
class NotifyException extends \Exception
|
||||
{
|
||||
use Exception;
|
||||
use Illuminate\Contracts\Support\Responsable;
|
||||
|
||||
class NotifyException extends Exception implements Responsable
|
||||
{
|
||||
public $message;
|
||||
public $redirectLocation;
|
||||
|
||||
@ -15,4 +17,19 @@ class NotifyException extends \Exception
|
||||
$this->redirectLocation = $redirectLocation;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the response for this type of exception.
|
||||
* @inheritdoc
|
||||
*/
|
||||
public function toResponse($request)
|
||||
{
|
||||
$message = $this->getMessage();
|
||||
|
||||
if (!empty($message)) {
|
||||
session()->flash('error', $message);
|
||||
}
|
||||
|
||||
return redirect($this->redirectLocation);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user