嘿大家我正在创建一个销售数字商品的电子商务网站。这是我的第一个Laravel应用程序。最初,我甚至无法加载登录页面或注册页面,直到运行php artisan make:auth
,这会创建一堆视图并编辑我的路径文件。我现在收到了注册表单,但是我收到了“未按要求设置会话存储”。提交时出错。我查看了this问题,但在添加了我的身份验证路由之后,我得到了“未按要求设置会话存储”。错误。这是文件:
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for 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.
|
*/
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for 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');
});
Route::post('/item/create', ['as' => 'item.store', 'uses' => 'ItemController@store']);
Route::resource('item', 'ItemController');
Route::group(['middleware' => ['web']], function(){
Route::get('/register', 'Auth\AuthController@getRegister');
Route::post('/register', 'Auth\AuthController@postRegister');
Route::auth();
Route::get('/checkout', function() {
return view('cart.checkout');
});
Route::get('/home', 'HomeController@index');
Route::post('/item', 'ItemController@store');
Route::get('/item', 'ItemController@index');
Route::get('/item/{id}', 'ItemController@show');
Route::get('/addItem/{productID}', 'CartController@addItem');
Route::get('/removeItem/{productID}', 'CartController@removeItem');
});
//Route
Route::post('/create_payment', function(){
// Set your secret key: remember to change this to your live secret key in production
// See your keys here https://dashboard.stripe.com/account/apikeys
\Stripe\Stripe::setApiKey("sk_test_VVSBY8xjNklioi7V0yFVfx6Q");
$receiver = \Stripe\BitcoinReceiver::create(array(
"amount" => 1000, // amount in cents
"currency" => "usd", // presently can only be USD
"email" => "payinguser+fill_now@example.com"
));
$charge = \Stripe\Charge::create(array(
"amount" => $receiver->amount,
"currency" => $receiver->currency,
"source" => $receiver->id,
"description" => "Example charge"
));
Route::controllers([
'auth' => 'Auth\AuthController',
'password' => 'Auth\PasswordController'
]);
});
Route::get('/logout', 'Auth\AuthController@getLogout');
// Registration routes...
Route::get('/home', 'HomeController@index');
非常感谢任何帮助!
答案 0 :(得分:2)
首先创建一个控制器。 php artisan make:controller UserController
。在 UserController 中,在 routes.php 中创建一个显示登录页面public function getLogin(){ return view (login)}
的函数,然后创建路径方法。 Route::get('/login', 'UserController@getLogin')