Всем привет, Laravel 10, при обращении по ссылке: site.ru/admin/auth - ошибка:
Target class [admin] does not exist.
При этом на Laravel 8 (или даже 9) все работало и не было такой ошибки.
RouteServiceProvider:
<?php
namespace App\Providers;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\Support\Facades\Route;
class RouteServiceProvider extends ServiceProvider
{
public const HOME = '/home';
protected $namespace = 'App\\Http\\Controllers';
public function boot(): void
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});
$this->routes(function () {
Route::middleware('api')
->prefix('api')
->group(base_path('routes/api.php'));
Route::middleware('web')
->group(base_path('routes/web.php'));
Route::middleware('admin')
->prefix('admin')
->name('admin.')
->namespace($this->namespace)
->group(base_path('routes/admin.php'));
});
}
}
/routes/admin.php
<?php
use Illuminate\Support\Facades\Route;
use App\Http\Controllers\Admin\AuthController;
Route::get('auth', [AuthController::class, 'show'])->name('auth');
app/Http/Controllers/Admin/AuthCintroller.php
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
class AuthController extends Controller
{
public function show()
{
dd('ok');
}
}