Laravel: Change password

Adding users is faster and more efficient for eCommerce website. This is particularly helpful for companies who add large volumes of users on an ongoing basis. Sending email using a cron has numerous benefits for growing customers in the website. Many of our customers purchased product, but some customers are not logged in the website from long time or some customers are even not logged in the website. So i am writing this post which helps to send mail to not logged in customers.

<?php

$customer = Auth::User();
if(!$customer){
	return Redirect::to('dashboard')->withErrors(Lang::get('users/messages.login_to_get_access'))->withInput();
}

$data = Input::all();
$rules = array(
'old-password' => 'required|max:20|min:6',
'new-password' => 'required|min:6|max:20',
'confirm-password' => 'required|min:6|max:20|same:new-password'
);

$validator = Validator::make($data, $rules);

if($validator->fails()) {
	return Redirect::to('change-password')->withErrors($validator)->withInput();
}
else
{
	$oldPassword = Input::get('old-password');
	if(Hash::check($oldPassword, $customer->password))
	{

		$data = array(
'password' => Hash::make(Input::get('new-password')),
		);

		$model = new Customer;
		$model->where('id', $customer->id)->update($data);

		Auth::logout();
		Session::flash('success', Lang::get($this->_module.'/messages.change-password.success'));
		return Redirect::to('/');
	}
	else
	{
		return Redirect::to('change-password')->withErrors(Lang::get($this->_module.'/messages.change-password.error'));
	}

}

?>