public function error( $code = 404, $msg = "Resource not found" )
	{
		$request = HttpFactory::i()->request();

		if ( $request->ajax() || $request->wantsJson() )
			return new JsonResponse( ['error' => $msg] );
		else
			return new Response( Redirect::back()->withInput( $request->input() )->withErrors( ['error' => $msg] ) );
	}