api code global jain
This commit is contained in:
50
app/Exceptions/GeneralException.php
Normal file
50
app/Exceptions/GeneralException.php
Normal file
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace App\Exceptions;
|
||||
|
||||
use Exception;
|
||||
use Throwable;
|
||||
|
||||
class GeneralException extends Exception
|
||||
{
|
||||
/**
|
||||
* @var
|
||||
*/
|
||||
public $message;
|
||||
|
||||
/**
|
||||
* GeneralException constructor.
|
||||
*
|
||||
* @param string $message
|
||||
* @param int $code
|
||||
* @param Throwable|null $previous
|
||||
*/
|
||||
public function __construct($message = '', $code = 0, Throwable $previous = null)
|
||||
{
|
||||
parent::__construct($message, $code, $previous);
|
||||
}
|
||||
|
||||
/**
|
||||
* Report the exception.
|
||||
*/
|
||||
public function report()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Render the exception into an HTTP response.
|
||||
*
|
||||
* @param \Illuminate\Http\Request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function render($request)
|
||||
{
|
||||
|
||||
// All instances of GeneralException redirect back with a flash message to show a bootstrap alert-error
|
||||
return redirect()
|
||||
->back()
|
||||
->withInput()
|
||||
->with('toast_warning', $this->message);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user