How to update and fetch data of mysql table in laravel 5
<p>i created one view page using laravel 5.2, in that page created one table and fetch data from mysql database. and give dynamic drop down button for Edit and Delete. when i click on delete it will delete the corresponding row from the table.That i done and working properly. I want to do the Edit part. When i click on Edit option it will redirect to one form where i need to fetch all the details from corresponding row into form text field and we can edit the things , when we click on save button it will update the data to the mysql table. 
Here i am not able to fetch the details of corresponding row into the form text field. Can anyone help me to do that.
my view page "userAdmin.blade.php" is</p>

<pre><code> @extends('app')

@section('content')


    &lt;div class="templatemo-content-wrapper" xmlns="http://www.w3.org/1999/html"&gt;
        &lt;ol class="breadcrumb"&gt;
            &lt;li&gt;&lt;a href="{{ url("/") }}"&gt;&lt;font color="green"&gt;Home&lt;/font&gt;&lt;/a&gt;&lt;/li&gt;
            &lt;li class="active"&gt;user information&lt;/li&gt;
        &lt;/ol&gt;
        &lt;div class="templatemo-content"&gt;

            &lt;h1&gt;View/Edit user information&lt;/h1&gt;

            &lt;div&gt;
                &lt;div&gt;
                    &lt;div&gt;

                        &lt;table id="example" class="table table-striped table-hover table-bordered" bgcolor="#fff8dc"&gt;
                            &lt;h3&gt;Select User :&lt;/h3&gt;
                            &lt;thead&gt;
                            &lt;tr&gt;
                                &lt;th&gt;User ID&lt;/th&gt;
                                &lt;th&gt;User Desc&lt;/th&gt;
                                &lt;th&gt;Contact Name&lt;/th&gt;
                                &lt;th&gt;Contact Email&lt;/th&gt;
                                &lt;th&gt;Time Zone&lt;/th&gt;
                                &lt;th&gt;Active&lt;/th&gt;
                                &lt;th&gt;Last Login (GMT+05:30)&lt;/th&gt;
                                &lt;th&gt;Actions&lt;/th&gt;
                            &lt;/tr&gt;
                            &lt;/thead&gt;
                            &lt;tbody&gt;

                            {{--{{ UserController::getIndex() }}--}}
                            @foreach($name as $nam)
                                &lt;tr&gt;
                                    &lt;td&gt;{{ $nam-&gt;userID }}&lt;/td&gt;
                                    &lt;td&gt;{{ $nam-&gt;description }}&lt;/td&gt;
                                    &lt;td&gt;{{ $nam-&gt;contactName }}&lt;/td&gt;
                                    &lt;td&gt;{{ $nam-&gt;contactPhone }}&lt;/td&gt;
                                    &lt;td&gt;{{ $nam-&gt;timeZone }}&lt;/td&gt;
                                    &lt;td&gt;
                                        @if($nam-&gt;isActive == '1')
                                            Yes
                                            @else
                                        No
                                            @endif
                                    &lt;/td&gt;
                                    &lt;td&gt;{{ date('Y/m/d H:i:s',($nam-&gt;lastLoginTime)) }}&lt;/td&gt;
                                    &lt;td&gt;
                                        {{--@if ( in_array($nam-&gt;isActive, array('Yes','No')) )--}}

                                            &lt;div class="btn-group"&gt;
                                                &lt;button type="button" class="btn btn-info"&gt;Action&lt;/button&gt;
                                                &lt;button type="button" class="btn btn-info dropdown-toggle" data-toggle="dropdown"&gt;
                                                    &lt;span class="caret"&gt;&lt;/span&gt;
                                                    &lt;span class="sr-only"&gt;Toggle Dropdown&lt;/span&gt;
                                                &lt;/button&gt;
                                                &lt;ul class="dropdown-menu" role="menu"&gt;
                                                    {{--@if ($nam-&gt;isActive == 'Yes')--}}
                                                        &lt;li data-toggle="modal" data-target="#acceptModal" data-bookingid="{{ $nam-&gt;userID }}"&gt;&lt;a href="{{ url('user/add/'.$nam-&gt;userID) }}"&gt;View/ Edit&lt;/a&gt;
                                                        &lt;/li&gt;
                                                    {{--@endif--}}
                                                    &lt;li&gt;&lt;a href="{{ url('/user/delete/'.$nam-&gt;userID)}}"&gt;Delete&lt;/a&gt;&lt;/li&gt;
                                                &lt;/ul&gt;
                                            &lt;/div&gt;
                                        {{--@endif--}}
                                    &lt;/td&gt;
                                &lt;/tr&gt;
                            @endforeach
                            &lt;/tbody&gt;
                        &lt;/table&gt;
                        {{$name-&gt;links()}}
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;


    &lt;a href="{{ url('user/add') }}"&gt; &lt;input type="submit" id="add" name="add" value="Edit" class="button"&gt;&lt;/a&gt;

                &lt;/br&gt;




    &lt;h4&gt;Create a new User&lt;/h4&gt;
    &lt;form role="form" method="POST" action="{{ url('userAdmin') }}"&gt;
        &lt;input type="hidden" name="_token" value="{{ csrf_token() }}"&gt;


        &lt;div class="row"&gt;
            &lt;div class="col-md-6 margin-bottom-15"&gt;

                &lt;input type="text" class="form-control" name="userID" value="{{ old('userID') }}" placeholder="Enter User ID"&gt;
            &lt;/div&gt;
            &lt;div class="row templatemo-form-buttons"&gt;
                &lt;div class="submit-button"&gt;
                    &lt;button type="submit" class="btn btn-primary"&gt;New&lt;/button&gt;

                &lt;/div&gt;
            &lt;/div&gt;
            &lt;/div&gt;
    &lt;/form&gt;

&lt;script type="text/javascript"&gt;
        $(document).ready(function() {
            $('#example').dataTable();
        } );
    &lt;/script&gt;
@endsection
</code></pre>

<p>and Controller page "userController.php" is </p>

<pre><code>  &lt;?php
/**
 * Created by PhpStorm.
 * User: Rahul vp
 * Date: 12/05/16
 * Time: 11:06 AM
 */

namespace App\Http\Controllers;

use Mail;
use Illuminate\Support\Facades\DB;
use Faker\Provider\DateTime;
use App\User;
use App\Http\Requests\createUserRequest;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Validator;
use Illuminate\Support\Facades\Input;
use Symfony\Component\HttpFoundation\Request;

class UserController extends Controller
{
    public $type = 'User';





    public function getIndex()
    {

        $name = DB::table('user')-&gt;simplePaginate(10);
        return view('user.userAdmin')-&gt;with('name', $name);
    }

    public function getData()
    {

        $name = DB::table('user');
        return view('user.add')-&gt;with('name', $name);
    }

    public function userInsert()
    {
        $postUser = Input::all();
        //insert data into mysql table
        $data =      array('userID'=&gt; $postUser['userID']
        );
        //  echo print_r($data);
        $ck = 0;
        $ck = DB::table('user')-&gt;Insert($data);
        //echo "Record Added Successfully!";
        $name = DB::table('user')-&gt;simplePaginate(10);
        return view('user.userAdmin')-&gt;with('name', $name);


    }

    public function delete($id)
    {
        DB::table('user')-&gt;where('userID', '=', $id)-&gt;delete();
        return redirect('userAdmin');
    }

}
</code></pre>

<p>then the Editing page where i need to fetch data for updation "add.blade.php"</p>

<pre><code>   @extends('app')

@section('content')

    &lt;div class="templatemo-content-wrapper"&gt;
        &lt;div class="container"&gt;
            &lt;ol class="breadcrumb"&gt;
                &lt;li&gt;&lt;a href="{{ url("/") }}"&gt;&lt;font color="green"&gt;Home&lt;/font&gt;&lt;/a&gt;&lt;/li&gt;
                &lt;li class="active"&gt;View/Edit User&lt;/li&gt;
            &lt;/ol&gt;
            &lt;div class="row"&gt;
                &lt;div class="col-md-8 col-md-offset-2"&gt;
                    &lt;div class="panel panel-success"&gt;
                        &lt;div class="panel-heading"&gt;View/Edit User Information&lt;/div&gt;
                        &lt;div class="panel-body"&gt;
                            @if (count($errors) &gt; 0)
                                &lt;div class="alert alert-danger"&gt;
                                    &lt;strong&gt;Whoops!&lt;/strong&gt; There were some problems with your input.&lt;br&gt;&lt;br&gt;
                                    &lt;ul&gt;
                                        @foreach ($errors-&gt;all() as $error)
                                            &lt;li&gt;{{ $error }}&lt;/li&gt;
                                        @endforeach
                                    &lt;/ul&gt;
                                &lt;/div&gt;
                            @endif

                            &lt;form class="form-horizontal" role="form" method="POST" action="{{ url('accountAdmin') }}"&gt;
                                &lt;input type="hidden" name="_token" value="{{ csrf_token() }}"&gt;

                                &lt;div class="form-group"&gt;
                                    &lt;label class="col-md-4 control-label"&gt;User ID&lt;/label&gt;
                                    &lt;div class="col-md-6"&gt;

                                        &lt;input type="text" class="form-control" name="userID" value="{{ old('userID')}}" placeholder="Enter User ID"&gt;

                                    &lt;/div&gt;
                                &lt;/div&gt;


                                &lt;div class="form-group"&gt;
                                    &lt;label class="col-md-4 control-label"&gt;Active&lt;/label&gt;
                                    &lt;div class="col-md-6"&gt;
                                        &lt;select class="form-control" value="{{ old('isActive') }}" name="isActive" &gt;
                                            &lt;option value="1"&gt;Yes&lt;/option&gt;
                                            &lt;option value="0"&gt;No&lt;/option&gt;
                                        &lt;/select&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;

                                &lt;div class="form-group"&gt;
                                    &lt;label class="col-md-4 control-label"&gt;User Description&lt;/label&gt;
                                    &lt;div class="col-md-6"&gt;
                                        &lt;input type="text" class="form-control" name="description" value="{{ old('description') }}" placeholder="Enter the description"&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;

                                &lt;div class="form-group"&gt;
                                    &lt;label class="col-md-4 control-label"&gt;Contact Name&lt;/label&gt;
                                    &lt;div class="col-md-6"&gt;
                                        &lt;input type="text" class="form-control" name="contactName" value="{{ old('contactName') }}" placeholder="Enter Contact Name"&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;

                                &lt;div class="form-group"&gt;
                                    &lt;label class="col-md-4 control-label"&gt;Contact Phone&lt;/label&gt;
                                    &lt;div class="col-md-6"&gt;
                                        &lt;input type="text" class="form-control" name="contactPhone" value="{{ old('contactPhone') }}" placeholder="Enter Mobile Number"&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;

                                &lt;div class="form-group"&gt;
                                    &lt;label class="col-md-4 control-label"&gt;Contact Email&lt;/label&gt;
                                    &lt;div class="col-md-6"&gt;
                                        &lt;input type="email" class="form-control" name="contactEmail" value="{{ old('contactEmail') }}" placeholder="Enter E-Mail Address"&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;

                                &lt;div class="form-group"&gt;
                                    &lt;label class="col-md-4 control-label"&gt;Notify Email&lt;/label&gt;
                                    &lt;div class="col-md-6"&gt;
                                        &lt;input type="email" class="form-control" name="notifyEmail" value="{{ old('notifyEmail') }}" placeholder="Enter E-Mail Address"&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;

                                &lt;div class="form-group"&gt;
                                    &lt;label class="col-md-4 control-label"&gt;Time Zone&lt;/label&gt;
                                    &lt;div class="col-md-6"&gt;
                                        &lt;select class="form-control" value="{{ old('timeZone') }}" name="timeZone" &gt;
                                            &lt;option value="0"&gt;GMT+05:30&lt;/option&gt;
                                            &lt;option value="Inactive"&gt;xyz&lt;/option&gt;
                                        &lt;/select&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;


                                &lt;div class="form-group"&gt;
                                    &lt;label class="col-md-4 control-label"&gt;Authorized Group&lt;/label&gt;
                                    &lt;div class="col-md-6"&gt;
                                        &lt;select class="form-control" value="{{ old('distanceUnits') }}" name="distanceUnits" &gt;
                                            &lt;option value="0"&gt;all&lt;/option&gt;
                                            &lt;option value="1"&gt;Km&lt;/option&gt;
                                            &lt;option value="2"&gt;Nm&lt;/option&gt;
                                        &lt;/select&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;

                                &lt;div class="form-group"&gt;
                                    &lt;label class="col-md-4 control-label"&gt;First Login page&lt;/label&gt;
                                    &lt;div class="col-md-6"&gt;
                                        &lt;select class="form-control" value="{{ old('firstLoginPageID') }}" name="firstLoginPageID" &gt;
                                            &lt;option value="0"&gt;Main Menu&lt;/option&gt;
                                            &lt;option value="1"&gt;Liter&lt;/option&gt;
                                            &lt;option value="2"&gt;IG&lt;/option&gt;
                                            &lt;option value="3"&gt;ft^3&lt;/option&gt;
                                        &lt;/select&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;

                                &lt;div class="form-group"&gt;
                                    &lt;label class="col-md-4 control-label"&gt;Maximum Access Level&lt;/label&gt;
                                    &lt;div class="col-md-6"&gt;
                                        &lt;select class="form-control" value="{{ old('maxAccessLevel') }}" name="maxAccessLevel" &gt;
                                            &lt;option value="3"&gt;New/Delete&lt;/option&gt;
                                            &lt;option value="1"&gt;Read/View&lt;/option&gt;
                                            &lt;option value="2"&gt;Write/Edit&lt;/option&gt;

                                        &lt;/select&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;


                                &lt;div class="form-group"&gt;
                                    &lt;div class="col-md-6 col-md-offset-4"&gt;
                                        &lt;button type="submit" class="btn btn-warning"&gt;
                                            Save
                                        &lt;/button&gt;
                                    &lt;/div&gt;
                                &lt;/div&gt;

                            &lt;/form&gt;
                        &lt;/div&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
@endsection
</code></pre>

<p>then route.php is</p>

<pre><code>    Route::any('userAdmin', 'UserController@getIndex');
Route::any('user/add', 'UserController@getData');
Route::any('user/delete/{id}', 'UserController@delete');
Route::post('userAdmin', 'UserController@userInsert');
Route::any('user/add', function()
{
    return view('user/add');
});
</code></pre>

<p>Anyone please help me to do this. response are appreciable.</p>