Action App\Http\Controllers\AdminController@dbTanger not defined.
And this is My AdminController
public function dbTanger() {
$data = Db::table('ressos')
->where('secteur','Services')
->get();
return view('backend.layouts.admin.typeFilterTanger',compact('data','pagi'));
}
And this is the view
<div >
<p>Filter Using Ville</p>
<a href="{{ action('AdminController@dbTanger') }}">Tanger-Asilah</a>
</div>
so if anyone can help me please and thank you all
CodePudding user response:
Since Laravel 9, the default Controller namespace has not been included in the RouteServiceProvider
so you need to be explicit about where to locate controllers (or add the default namespace to your RouteServiceProvider).
What you can do is the following:
{{ action('\App\Http\Controllers\AdminController@dbTanger') }}
However, I would recommend using the route
helper in conjunction with named routes as this is easier to manage should files change or move location in the future.
Route::get('/admin/dbTanger', [AdminController::class, 'dbTanger'])->name('admin.dbTanger');
Then use it as follows:
{{ route('admin.dbTanger') }}
The outcome is the same, just easier to manage and maintain long-term.
CodePudding user response:
Welcome to stack-overflow,
First you should learn the "basic routing" in laravel