We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New route group.
Rendered view
404 not found error
// config/common/routes.php
use App\Controller\SiteController; use App\Backend\Controller\SiteController as BackendController; use App\Controller\AccomodationController; use Yiisoft\Router\Group; use Yiisoft\Router\Route; return [ Group::create('/{_language}') ->routes( Route::get('/')->action([SiteController::class, 'index'])->name('home'), Route::get('/kontakt')->action([SiteController::class, 'contact'])->name('kontaktformular'), Route::get('/publikation')->action([SiteController::class, 'publication'])->name('publikation'), Route::get('/test1')->action([SiteController::class, 'test1'])->name('test1'), Route::get('/accomodation')->action([AccomodationController::class, 'index'])->name('overview'), Route::get('/unterkunft/{slug}')->action([AccomodationController::class, 'show'])->name('showaccomodation'), ), Group::create('/backend') ->routes( Route::get('/')->action([BackendController::class, 'index'])->name('dashboard'), ), ];
// backend/Controller/SiteController.php
namespace App\Backend\Controller; use Psr\Http\Message\ResponseInterface; use Yiisoft\Yii\View\ViewRenderer; use Yiisoft\Db\Connection\ConnectionInterface; final class SiteController { public function __construct(private ViewRenderer $viewRenderer) { $this->viewRenderer = $viewRenderer ->withLayout('@resources/backend/views/layout/main') ->withViewPath('@resources/backend/views'); } public function index(): ResponseInterface { /** @var ConnectionInterface $db */ // $rassen = $this->db->createCommand('SELECT * FROM {{%vdh_rassen}}')->queryAll(); // $rows = (new Query($this->db)) // ->select(['name', 'ursprungsland']) // ->from('{{%vdh_rassen}}') // ->where(['ursprungsland' => 'Japan']) // ->limit(10) // ->all(); return $this->viewRenderer->render('index'); } }
if i do something like this it works:
Group::create('/{kk}') ->routes( Route::get('/backend')->action([BackendController::class, 'index'])->name('dashboard'), ),
The text was updated successfully, but these errors were encountered:
No branches or pull requests
What steps will reproduce the problem?
New route group.
What is the expected result?
Rendered view
What do you get instead?
404 not found error
Additional info
// config/common/routes.php
// backend/Controller/SiteController.php
if i do something like this it works:
The text was updated successfully, but these errors were encountered: