Laravel, localhost works fine, but with laragon {name}.test I get errors.
The problem I have is that when I start the server in the Laragon terminal, localhost works perfectly, but in Laragon when I open the page (right click -> www -> {project}) I get errors that I don't get in localhost, for example:
Undefined variable $txt
my index code:
<body>
<nav class="navbar navbar-dark bg-dark">
<div class="container-fluid">
<form class="d-flex" action="{{route('articles.index')}}" method="get">
<input class="form-control me-2" type="text" placeholder="Search" aria-label="Search" name="text" value="{{$txt}}">
<button class="btn btn-outline-success" type="submit">Search</button>
<a href="{{route('articles.create')}}" class="btn btn-outline-success">Add</a>
</form>
</div>
</nav>
{{$articles->links()}}
<div class="div1">
@if(Session::get('success'))
<div class="alert alert-success mt-2">
<strong>{{Session::get('success')}}</strong><br>
</div>
@endif
</div>
<div class="site-container">
<div class="article-container">
@foreach ($articles as $arti)
<article class="article-card card">
<figure class="article-image">
<img src="{{$arti->AImage}}" class="card-img-top img-product" alt="Not found">
</figure>
<div class="article-content">
<a class="card-category">{{$arti->AName}}</a>
@if ($arti->APrice==0.0)
<h3 class="card-title" style="color:rgb(255, 255, 255);">Free</h3>
@endif
@if($arti->APrice>0.0)
<h3 class="card-title" style="color:rgb(255, 255, 255);">{{$arti->APrice}}</h3>
@endif
<p class="card-excerpt">{{$arti->Adescription}}</p>
<p class="card-excerpt">Stock: {{$arti->AStock}}</p>
<div class="box">
<form action="{{route('articles.stocks',$arti->idArticulos)}}"" class="d-inline f-buy"><a><button type="button" class="btnBuy ">Buy</button></a></form>
<button type="button" class="btnDelete">Delete</button>
<a href="{{route('articles.edit', $arti->idArticulos)}}"><button class="btnModify">Modify</button></a>
</div>
</div>
</article>
@endforeach
</div>
</div>
</body>
@endsection
localhost: Localhost with laragon (Pretty URLs): Pretty URLs
NOTE: I am new to programming in Laravel
I read that the variables are described in the web.php file, in this case $text and $articulos, I tried it but I got an error regarding {{$articulos->links()}}
mistake:
Call to a member function links() on string
my web.php code with the changes
Route::get('/', function () {
return view('index',['txt'=>'','articles'=>'']);
});