title: Unable to show data from database in Laravel after inserting data into database
body: <p>I was able to insert data into database in Laravel but when I was trying to show the data in a tabular form I couldn't - it was displaying <code>Route [stock_edit] not defined. (View: C:\wamp\www\pump\core\resources\views\dashboard\stock-show.blade.php)</code></p>
  
  <p>Like I said in my quetion yesterday, I am new to Laravel and I am yet to understand the environment. I have been on this for the past 48 hours searching for help online but couldn't find a satisfactory ones</p>
  
  <p>Here is my stock-show.blade.php</p>
  
  <pre><code>@extends('layouts.dashboard')
  @section('title', 'All Stock')
  @section('content')
  
  
      @if(count($stock))
  
          &lt;div class="row"&gt;
              &lt;div class="col-md-12"&gt;
  
  
                  &lt;div class="portlet light bordered"&gt;
                      &lt;div class="portlet-title"&gt;
                          &lt;div class="caption font-dark"&gt;
                          &lt;/div&gt;
                          &lt;div class="tools"&gt; &lt;/div&gt;
                      &lt;/div&gt;
                      &lt;div class="portlet-body"&gt;
                          &lt;table class="table table-striped table-bordered table-hover" id="sample_1"&gt;
  
                              &lt;thead&gt;
                              &lt;tr&gt;
                                  &lt;th&gt;ID#&lt;/th&gt;
                                  &lt;th&gt;Product Name&lt;/th&gt;
                                  &lt;th&gt;Price&lt;/th&gt;
                                  &lt;th&gt;Action&lt;/th&gt;
                              &lt;/tr&gt;
                              &lt;/thead&gt;
  
                              &lt;tbody&gt;
                              @foreach($stock as $p)
                                  &lt;tr&gt;
  
                                      &lt;td&gt;{{ $p-&gt;id }}&lt;/td&gt;
                                      &lt;td&gt;{{ $p-&gt;name }}&lt;/td&gt;
                                      &lt;td&gt;{{ $p-&gt;price }} &lt;/td&gt;
                                      &lt;td&gt;
  
                                          &lt;a href="{{ route('stock_edit',$p-&gt;id) }}" class="btn purple btn-sm"&gt;&lt;i class="fa fa-edit"&gt;&lt;/i&gt; EDIT&lt;/a&gt;
  
                                          &lt;button type="button" class="btn btn-danger btn-sm delete_button"
                                                  data-toggle="modal" data-target="#DelModal"
                                                  data-id="{{ $p-&gt;id }}"&gt;
                                              &lt;i class='fa fa-times'&gt;&lt;/i&gt; DELETE
                                          &lt;/button&gt;
  
                                      &lt;/td&gt;
  
                                  &lt;/tr&gt;
                              @endforeach
  
                              &lt;/tbody&gt;
                          &lt;/table&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
  
              &lt;/div&gt;
          &lt;/div&gt;&lt;!-- ROW--&gt;
  
  
          &lt;div class="text-center"&gt;
              {!! $stock-&gt;render() !!}
          &lt;/div&gt;
      @else
  
          &lt;div class="text-center"&gt;
              &lt;h3&gt;No Data available&lt;/h3&gt;
          &lt;/div&gt;
          @endif
  
                  &lt;!-- Modal for DELETE --&gt;
          &lt;div class="modal fade" id="DelModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt;
              &lt;div class="modal-dialog"&gt;
                  &lt;div class="modal-content"&gt;
                      &lt;div class="modal-header"&gt;
                          &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
                          &lt;h4 class="modal-title" id="myModalLabel"&gt; &lt;i class='fa fa-trash'&gt;&lt;/i&gt; Delete !&lt;/h4&gt;
                      &lt;/div&gt;
  
                      &lt;div class="modal-body"&gt;
                          &lt;strong&gt;Are you sure you want to Delete ?&lt;/strong&gt;
                      &lt;/div&gt;
  
                      &lt;div class="modal-footer"&gt;
                          &lt;form method="post" action="{{ route('stock_delete') }}" class="form-inline"&gt;
                              {!! csrf_field() !!}
                              {{ method_field('DELETE') }}
                              &lt;input type="hidden" name="id" class="abir_id" value="0"&gt;
  
                              &lt;button type="button" class="btn btn-default" data-dismiss="modal"&gt;Close&lt;/button&gt;
                              &lt;button type="submit" class="btn btn-danger"&gt;DELETE&lt;/button&gt;
                          &lt;/form&gt;
                      &lt;/div&gt;
  
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
  @endsection
  
  @section('scripts')
  
      &lt;script&gt;
          $(document).ready(function () {
  
              $(document).on("click", '.delete_button', function (e) {
                  var id = $(this).data('id');
                  $(".abir_id").val(id);
  
              });
  
          });
      &lt;/script&gt;
  
  @endsection
  </code></pre>
  
  <p>and this is the DashboardController.php</p>
  
  <pre><code>//Stocks
      public function createStock()
      {
          $data['site_title'] = $this-&gt;site_title;
          $data['page_title'] = "Create Stock";
          //$data['currency'] = Currency::all();
          return view('dashboard.stock-create',$data);
      }
      public function storeStock(Request $request)
      {
          $this-&gt;validate($request,[
             'name' =&gt; 'required|unique:stocks,name',
              'price' =&gt; 'required',
              //'currency_id' =&gt; 'required'
          ]);
          try {
              $stock = Input::except('_method','_token');
              Stock::create($stock);
              session()-&gt;flash('message', 'Stock Create Successfully.');
              Session::flash('type', 'success');
              return redirect()-&gt;back();
          } catch (\PDOException $e) {
              session()-&gt;flash('message', 'Some Problem Occurs, Please Try Again!');
              Session::flash('type', 'danger');
              return redirect()-&gt;back();
          }
  
  
      }
      public function showStock()
      {
          $data['site_title'] = $this-&gt;site_title;
          $data['page_title'] = "All Stock";
          $data['stock'] = Stock::orderBy('id','ASC')-&gt;paginate(100);
          return view('dashboard.stock-show',$data);
      }
      public function editStock($id)
      {
          $data['stock'] = Stock::findOrFail($id);
          $data['site_title'] = $this-&gt;site_title;
          $data['page_title'] = 'Edit Product';
          $data['stock'] = Stock::all();
          return view('dashboard.stock-edit',$data);
      }
      public function updateStock(Request $request,$id)
      {
          $stocks = Stock::findOrFail($id);
          $this-&gt;validate($request,[
             'name' =&gt; 'required|unique:stocks,name,'.$stocks-&gt;id,
              'price' =&gt; 'required',
              //'currency_id' =&gt; 'required',
          ]);
          try {
              $stock = Input::except('_method','_token');
              $stocks-&gt;fill($stock)-&gt;save();
              session()-&gt;flash('message', 'Stock Updated Successfully.');
              Session::flash('type', 'success');
              return redirect()-&gt;back();
          } catch (\PDOException $e) {
              session()-&gt;flash('message', 'Some Problem Occurs, Please Try Again!');
              Session::flash('type', 'danger');
              return redirect()-&gt;back();
          }
      }//Stocks End
  </code></pre>
  
  <p>And lastly the route.php</p>
  
  <pre><code>/* Stock Route List */
  Route::get('stock-create',['as'=&gt;'stock-create','uses'=&gt;'DashboardController@createStock']);
  Route::post('stock-create',['as'=&gt;'stock-store','uses'=&gt;'DashboardController@storeStock']);
  Route::get('stock-show',['as'=&gt;'stock-show','uses'=&gt;'DashboardController@showStock']);
  Route::get('stock-edit/{id}',['as'=&gt;'stock-edit','uses'=&gt;'DashboardController@editStock']);
  Route::put('stock-edit/{id}',['as'=&gt;'stock-update','uses'=&gt;'DashboardController@updateStock']);
  </code></pre>