'Laravel 4 Redirect::back() not going to previous page (refreshing current page)

I have a simple Lavel 4 project and I am trying to do a simple redirect to the previous page after the information has been submitted. However, when inserting Redirect::back() it's only refreshing the current page. How can I get it to redirect properly to the previous page it was on?

Controller

    public function saveCustomer($id) { 

    $zip_code = DB::table('zip_codes')
                    ->where('zip_code', Input::get('user_zip_code'))
                    ->first();  

    if (!empty(Input::get('user_id'))) {
        $user_id = Input::get('user_id');

        $user = User::find($user_id);

        $user->user_zip_code = $zip_code->zip_code;

        $user->office = $zip_code->office;

        $user->save();

    } else {
        $user_id = NULL;
    }       

    $userdata = [
                'user_id' => $user_id,
                'first_name' => Input::get('first_name'),
                'last_name' => Input::get('last_name'),
                'street_1' => Input::get('street_1'),  
                'street_2' => Input::get('street_2'),  
                'apartment' => Input::get('apartment'),
                'phone_1' => Input::get('phone_1'),  
                'phone_2' => Input::get('phone_2'),
                'state' => 'Alabama',
              'user_zip_code' => Input::get('user_zip_code'),
              'city' => $zip_code->city
            ];                
            $rules = array(
                'first_name' => 'required',
                'last_name' => 'required',
                'street_1' => 'required',
                'phone_1' => 'required'
            );

            $validation = Validator::make($userdata, $rules);

            if($validation->fails()){
                return Redirect::to("customer/edit/$id")->withErrors($validation)->withInput();
            } 

            UsersInformation::find($id)->update($userdata);

            return Redirect::back();

Blade template

    {{ Form::open(array('name' => 'edit customer', 'action' => array('CustomerController@saveCustomer', $customer->id)))}}
       @foreach($errors->all() as $error)
                <p class="albox errorbox">{{$error}}</p>
            @endforeach
            <div class="four columns">      
        @if (isset($customer->first_name))
            {{ Form::hidden('user_id', '' . $customer->user_id . '')}}
        @endif                  
        <label class="form">First Name:</label> <span class="required"> (required)</span><br />
        @if (isset($customer->first_name))
            {{ Form::text('first_name', '' . $customer->first_name . '')}}<br />
        @else
            {{ Form::text('first_name')}}<br />
        @endif

        <label class="form">Last Name:</label> <span class="required"> (required)</span><br />
        @if (isset($customer->last_name))
            {{ Form::text('last_name', '' . $customer->last_name . '')}}<br />
        @else
            {{ Form::text('last_name')}}<br />
        @endif

        <label class="form">Primary Street:</label> <br />
        @if (isset($customer->street_1))
            {{ Form::text('street_1', '' . $customer->street_1 . '')}}<br />
        @else
            {{ Form::text('street_1')}}<br />
        @endif  

        <label class="form">Secondary Street:</label> <br />
        @if (isset($customer->street_2))
            {{ Form::text('street_2', '' . $customer->street_2 . '')}}<br />
        @else
            {{ Form::text('street_2')}}<br />
        @endif              

        <label class="form"> Primary Phone Number:</label> <br />
        @if (isset($customer->phone_1))
            {{ Form::text('phone_1', '' . $customer->phone_1 . '')}}<br />
        @else
            {{ Form::text('phone_1')}}<br />
        @endif

        <label class="form">Secondary Phone Number:</label> <br />
        @if (isset($customer->phone_2))
            {{ Form::text('phone_2', '' . $customer->phone_2 . '')}}<br />
        @else
            {{ Form::text('phone_2')}}<br />
        @endif          

        <label class="form">Apartment:</label><br />
        @if (isset($customer->apartment))
            {{ Form::text('apartment', '' . $customer->apartment . '')}}<br />
        @else
            {{ Form::text('apartment')}}<br />
        @endif
<label class="form">City/Zip Code:</label> <span class="required"> (required)</span><br />      
        <select name="user_zip_code"> 
            <option value='{{{ $customer->user_zip_code }}}'>{{{ $customer->city  }}} - {{{ $customer->user_zip_code }}}</option>
             @foreach ($zip_code as $zip_codes)
                <option value='{{ $zip_codes->zip_code  }}'>{{ $zip_codes->city  }} - {{ $zip_codes->zip_code  }}</option>
             @endforeach
        </select><br />         

<button type="submit" class="button is-success">Save</button><br /><br />
            </div>
{{ Form::close() }}

Not sure if needed but here is also my route.php page

Route::get('customer/edit/{id}', 'CustomerController@editCustomer');


Solution 1:[1]

By current page, do you mean the page where the form is? If yes, than it is in fact redirecting back – it goes to the controller action, process everything in the saveCustomer() and redirects back to the form page.

The question is...is it saving the user in the DB?

P.S You should have all you database logic in the model rather than in the controller – makes the whole app more modular, easier to test and your controllers thinner.

Edit Use a named route, and redirect explicitly to it.

Routes.php

Route::get('/customer', array('as' => 'customer', 'uses' => 'MyController@showCustomer'));

Controller.php

function saveCustomer($id) {

    ...

    Redirect::route('customer');
}

Solution 2:[2]

Use:

if(isset($_SERVER['HTTP_REFERER']))
    return Redirect::back();

return Redirect::to('/');

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1
Solution 2 Davinder Singh