laravel how to extend controller code example
Example: extend custom controller in laravel
public function error($message = null, Exception $ex) { return response()->json([ 'message' => $message ?? 'an error occurred', 'exception' => $ex ], 500);}