-2
我用make命令:AUTH而事实证明:Laravel5使:AUTH不起作用
Created View: /var/www/myblog/resources/views/auth/login.blade.php
Created View: /var/www/myblog/resources/views/auth/register.blade.php
Created View: /var/www/myblog/resources/views/auth/passwords/email.blade.php
Created View: /var/www/myblog/resources/views/auth/passwords/reset.blade.php
Created View: /var/www/myblog/resources/views/auth/emails/password.blade.php
Created View: /var/www/myblog/resources/views/layouts/app.blade.php
Created View: /var/www/myblog/resources/views/home.blade.php
Created View: /var/www/myblog/resources/views/welcome.blade.php
Installed HomeController.
Updated Routes File.
Authentication scaffolding generated successfully!
看起来很好,我得到了正确显示了一个主页。 see picture here
但是当我试图访问登录和注册页面时,出现了一些问题。 它给了我这样的错误:
Not Found
The requested URL /login was not found on this server.
Apache/2.4.7 (Ubuntu) Server at ...
和我打的PHP工匠路线:名单终端,我得到这个:
+--------+-----------+-------------------------+-----------------+-----------------------------------------------------------------+------------+
| Domain | Method | URI | Name | Action | Middleware |
+--------+-----------+-------------------------+-----------------+-----------------------------------------------------------------+------------+
| | GET|HEAD |/ | | Closure | |
| | GET|HEAD | article | article.index | App\Http\Controllers\[email protected] | |
| | POST | article | article.store | App\Http\Controllers\[email protected] | |
| | GET|HEAD | article/create | article.create | App\Http\Controllers\[email protected] | |
| | DELETE | article/{article} | article.destroy | App\Http\Controllers\[email protected] | |
| | PUT|PATCH | article/{article} | article.update | App\Http\Controllers\[email protected] | |
| | GET|HEAD | article/{article} | article.show | App\Http\Controllers\[email protected] | |
| | GET|HEAD | article/{article}/edit | article.edit | App\Http\Controllers\[email protected] | |
| | GET|HEAD | home | | App\Http\Controllers\[email protected] | web,auth |
| | GET|HEAD | login | | App\Http\Controllers\Auth\[email protected] | web,guest |
| | POST | login | | App\Http\Controllers\Auth\[email protected] | web,guest |
| | GET|HEAD | logout | | App\Http\Controllers\Auth\[email protected] | web |
| | POST | password/email | | App\Http\Controllers\Auth\[email protected] | web,guest |
| | POST | password/reset | | App\Http\Controllers\Auth\[email protected] | web,guest |
| | GET|HEAD | password/reset/{token?} | | App\Http\Controllers\Auth\[email protected] | web,guest |
| | GET|HEAD | register | | App\Http\Controllers\Auth\[email protected] | web,guest |
| | POST | register | | App\Http\Controllers\Auth\[email protected] | web,guest |
+--------+-----------+-------------------------+-----------------+-----------------------------------------------------------------+------------+
这是从我的期望有点不同。因为我在laracast.com学到的东西,路由列表应该像“Auth \ login”而不仅仅是“登录”... Idk这里有什么问题,是因为我使用的是Apache吗?或其他配置我没有正确设置...寻求帮助
另外一个问题: 当我访问www.mydomain.com,我希望默认的欢迎页面,而不是auth的主页,但实际上它改为将auth的主页提供给我。但是当我试图访问www.mydomain.com/home时,我希望再次看到该主页,而我收到了404个未找到的错误,这使我很困惑。这里是我的routes.php:
<?php
/*
|--------------------------------------------------------------------------
| Routes File
|--------------------------------------------------------------------------
|
| Here is where you will register all of the routes in an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::get('/', function() {
return view('welcome');
});
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| This route group applies the "web" middleware group to every route
| it contains. The "web" middleware group is defined in your HTTP
| kernel and includes session state, CSRF protection, and more.
|
*/
Route::resource('article', 'ArticleController');
Route::group(['middleware' => 'web'], function() {
Route::auth();
Route::get('/home', '[email protected]');
});