A martingale approach for the elephant random walk