路由和前缀具有相同的名称。正如我在下面的图片中提到的那样,我无法获得其中为空的ID参数{hotel}。使用同名前缀和资源控制器的最佳方法是什么?
路由/web.php
Route::namespace('Admin\Hotel')->prefix('hotels')->name('hotels.')->group(function () {
Route::resource('/', 'HotelController');
Route::resource('rooms', 'RoomController');
Route::resource('rooms/gallery', 'RoomGalleryController');
});
Run Code Online (Sandbox Code Playgroud)
php artisan route:list 为了 Route::resource('/', 'HotelController')
登录后如何将用户重定向到当前页面?
用户在
domain.com/article/news-18565点击登录按钮后正在此 URL 上阅读新闻,然后我如何domain.com/login在登录用户之前和之后获取 currenturl()domain.com/article/news-18565
表单.html
<form action="signin" method="post" accept-charset="utf-8">
<div class="form-group">
<label for="">Email:</label>
<input type="text" name="email" value="" class="form-control form-control-lg">
</div>
<div class="form-group">
<label for="">Password:</label>
<input type="password" name="password" value="" class="form-control form-control-lg">
</div>
<div class="form-group">
<input type="submit" name="submit" value="Sign in to your account" class="float-md-right btn btn-primary">
</div>
</form>
Run Code Online (Sandbox Code Playgroud)
控制器.php
function index(){
$user_profile = 'user';
$this->authModel->loggedin() == FALSE || redirect($user_profile);
$rules = $this->authModel->rules;
$this->form_validation->set_rules($rules);
if($this->form_validation->run() == TRUE){
if($this->authModel->login() == TRUE){
redirect($user_profile);
}else{
$this->session->set_flashdata('error', 'That email/password combination does …Run Code Online (Sandbox Code Playgroud)