Php 方法\Http\RedirectResponse::getData不存在。登录后页面
我的登录验证有问题。我以前已经使用过Laravel的身份验证(通过使用Php 方法\Http\RedirectResponse::getData不存在。登录后页面,php,laravel,laravel-5.6,Php,Laravel,Laravel 5.6,我的登录验证有问题。我以前已经使用过Laravel的身份验证(通过使用make:auth),然后我决定使用自己的身份验证进行更改,并收到以下错误消息: 这是我的路线配置: Route::get('/home', 'HomeController@index')->name('home'); Route::post('login', 'authController@logIn'); Route::get('logout', 'authController@weblogOut'); Rout
make:auth
),然后我决定使用自己的身份验证进行更改,并收到以下错误消息:
这是我的路线配置:
Route::get('/home', 'HomeController@index')->name('home');
Route::post('login', 'authController@logIn');
Route::get('logout', 'authController@weblogOut');
Route::get('login', 'authController@showLogInPage');
Route::post('check_login', 'authController@checkLoginForWeb');
Route::get('web_logout', 'authController@webLogOut');
这是我的登录表:
<form method="POST" action="{{ url('check_login') }}" aria-label="{{ __('Login') }}">
@csrf
<div class="form-group has-feedback">
<input id="email" type="email" class="form-control{{ $errors->has('email') ? ' is-invalid' : '' }}"
name="email" placeholder="Email" value="{{ old('email') }}" required autofocus>
<span class="glyphicon glyphicon-envelope form-control-feedback"></span>
</div>
<div class="form-group has-feedback">
<input id="password" type="password"
class="form-control{{ $errors->has('password') ? ' is-invalid' : '' }}" name="password"
placeholder="Password" required>
<span class="glyphicon glyphicon-lock form-control-feedback"></span>
</div>
<div class="row">
<div class="col-xs-8">
<div class="checkbox icheck">
<label class="form-check-label" for="remember">
<input type="checkbox"> Remember Me
</label>
</div>
</div>
<!-- /.col -->
<div class="col-xs-4">
<button type="submit" class="btn btn-primary btn-block btn-flat">Sign In</button>
</div>
<!-- /.col -->
</div>
</form>
如果我没有包含所需的函数,请在注释部分告诉我。这对我来说很有用:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use App\User;
class UserController extends Controller {
/**
* Send back all users as JSON
*
* @return Response
*/
public function index() {
return response()->json(User::get(), 200);
}
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store() {
User::create(array(
'user_id' => Input::get('user_id'),
'post_id' => Input::get('post_id'),
'text' => Input::get('text')
));
return response()->json(array('success' => true), 200);
}
/**
* Return the specified resource using JSON
*
* @param int $id
* @return Response
*/
public function show($id) {
return response()->json(User::find($id));
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id) {
Comment::destroy($id);
return response()->json(array('success' => true), 200);
}
}
只需使用return response()->json(数组('success'=>'login Successful'),200)代码>
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Input;
use App\User;
class UserController extends Controller {
/**
* Send back all users as JSON
*
* @return Response
*/
public function index() {
return response()->json(User::get(), 200);
}
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store() {
User::create(array(
'user_id' => Input::get('user_id'),
'post_id' => Input::get('post_id'),
'text' => Input::get('text')
));
return response()->json(array('success' => true), 200);
}
/**
* Return the specified resource using JSON
*
* @param int $id
* @return Response
*/
public function show($id) {
return response()->json(User::find($id));
}
/**
* Remove the specified resource from storage.
*
* @param int $id
* @return Response
*/
public function destroy($id) {
Comment::destroy($id);
return response()->json(array('success' => true), 200);
}
}