0
I know it might be a beginner question, but I really can’t solve it, and I put the address in the browser the route works, but when I call from blade
doesn’t work.
I created a new route and I am unable to access the Blade. Below the code and the error.
web php.
Route::get('logteste', 'App\Http\Controllers\DashboardController@getLogteste');
Dashboardcontroller.php
<?php
namespace App\Http\Controllers;
use App\Repositories\UserRepository;
use App\Validators\UserValidator;
class DashboardController extends Controller
{
private $repository;
private $validator;
public function __construct(UserRepository $repository, UserValidator $validator)
{
$this->repository = $repository;
$this->validator = $validator;
}
public function getLogteste(Request $request)
{
echo ('teste');
}
}
call on the Blade
<span>
<a href="{{ route('logteste') }}">link</a>
</span>
Error that is presenting
Symfony\Component\Routing\Exception\RouteNotFoundException
Route [logteste] not defined. (View:>C:\xampp\htdocs\innovationone\resources\views\templates\menu.blade.php)
Try
Route::get('logteste', 'App\Http\Controllers\DashboardController@getLogteste')->name('logteste');
.... https://laravel.com/docs/8.x/urls#urls-for-named-Routes– Miguel