title: laravel Undefined variable: fetchdata (View: C:\xampp\htdocs\A3Solution\resources\views\A3View\view.blade.php)
body: <p>when i want to remain same page after deleting data. But it show this error after deleting data. Data is deleted but not showing same page</p>
  <p>alcontacts.blade.php</p>
  <pre><code> @foreach($fetch as $row)
  &lt;tr&gt;
    &lt;!-- &lt;th scope=&quot;row&quot;&gt;1&lt;/th&gt; --&gt;
    &lt;td&gt;{{$row-&gt;id}}&lt;/td&gt;
    &lt;td&gt;{{$row-&gt;exampleInputName}}&lt;/td&gt;
    &lt;td&gt;{{$row-&gt;exampleInputEmail}}&lt;/td&gt;
    &lt;td&gt;{{$row-&gt;exampleInputPhone}}&lt;/td&gt;
    &lt;td&gt;
    &lt;a href=&quot;&quot; class=&quot;btn btn-primary&quot;&gt;edit&lt;/a&gt;
    &lt;a href=&quot;{{ URL::to('dlte/'.$row-&gt;id)}}&quot; class=&quot;btn btn-danger&quot;&gt;delete&lt;/a&gt;
    &lt;a href=&quot;{{URL::to('fet')}}&quot;class=&quot;btn btn-success&quot;&gt;view&lt;/a&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
  
  @endforeach
  </code></pre>
  <p>controller.php</p>
  <pre><code> public function fetchData(Request $request)
  {
      $users = DB::table('infos')-&gt;get();
      return view('alcontacts')-&gt;with('fetch',$users);
  }
  public function delete($id)
  {
      $users = DB::table('infos')-&gt;where('id',$id)-&gt;delete();
      return Redirect()-&gt;route('ct');
  }
  
  web.php
  route::get('alctact',[InfoController::class,'alcontact'])-&gt;name('ct');
  route::get('fet',[InfoController::class,'fetchData']);
  route::get('dlte/{id}',[InfoController::class,'delete']);
  </code></pre>