Laravelで次のエラーが表示されます。すべてのリクエストでLaravelがエラーをスローする
ほとんどすべてのファイルを確認しました。
Whoops, looks like something went wrong.
1/1
ErrorException in Grammar.php line 252:
Undefined index: Type
in Grammar.php line 252
at HandleExceptionshandleError('8', 'Undefined index: Type', '/home/vagrant/Code/dq/vendor/laravel/framework/src/Illuminate/Database/Query/Grammars/Grammar.php', '252', array('query' => object(Builder), 'sql' => array(), 'where' => array('column' => 'email', 'operator' => '=', 'value' => '[email protected]', 'boolean' => 'and'))) in Grammar.php line 252
at GrammarcompileWheres(object(Builder), array(array('column' => 'email', 'operator' => '=', 'value' => '[email protected]', 'boolean' => 'and'))) in Grammar.php line 75
at GrammarcompileComponents(object(Builder)) in Grammar.php line 51
at GrammarcompileSelect(object(Builder)) in MySqlGrammar.php line 38
at MySqlGrammarcompileSelect(object(Builder)) in Builder.php line 1514
at BuildertoSql() in Builder.php line 1583
at BuilderrunSelect() in Builder.php line 1569
at Builderget(array('*')) in Builder.php line 624
at BuildergetModels(array('*')) in Builder.php line 316
at Builderget(array('*')) in Builder.php line 286
at Builderfirst() in compiled.php line 1032
at EloquentUserProviderretrieveByCredentials(array('email' => '[email protected]', 'password' => 'asdfasdfasdf')) in compiled.php line 611
at SessionGuardattempt(array('email' => '[email protected]', 'password' => 'asdfasdfasdf'), false, false) in compiled.php line 572
at SessionGuardvalidate(array('email' => '[email protected]', 'password' => 'asdfasdfasdf')) in compiled.php line 564
at SessionGuardonce(array('email' => '[email protected]', 'password' => 'asdfasdfasdf'))
at call_user_func_array(array(object(SessionGuard), 'once'), array(array('email' => '[email protected]', 'password' => 'asdfasdfasdf'))) in compiled.php line 465
at AuthManager__call('once', array(array('email' => '[email protected]', 'password' => 'asdfasdfasdf'))) in IlluminateAuthAdapter.php line 39
at IlluminateAuthAdapterbyCredentials(array('email' => '[email protected]', 'password' => 'asdfasdfasdf')) in JWTAuth.php line 108
at JWTAuthattempt(array('email' => '[email protected]', 'password' => 'asdfasdfasdf')) in compiled.php line 6325
at Facade__callStatic('attempt', array(array('email' => '[email protected]ail.com', 'password' => 'asdfasdfasdf'))) in AuthController.php line 17
at AuthControllerlogin(object(Request))
at call_user_func_array(array(object(AuthController), 'login'), array(object(Request))) in compiled.php line 9419
at ControllercallAction('login', array(object(Request))) in compiled.php line 9481
at ControllerDispatchercall(object(AuthController), object(Route), 'login') in compiled.php line 9461
at ControllerDispatcherIlluminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at PipelineIlluminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in compiled.php line 9938
at Pipelinethen(object(Closure)) in compiled.php line 9462
at ControllerDispatchercallWithinStack(object(AuthController), object(Route), object(Request), 'login') in compiled.php line 9449
at ControllerDispatcherdispatch(object(Route), object(Request), 'App\Http\Controllers\Auth\AuthController', 'login') in compiled.php line 8517
at RouterunController(object(Request)) in compiled.php line 8504
at Routerun(object(Request)) in compiled.php line 8218
at RouterIlluminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at PipelineIlluminate\Routing\{closure}(object(Request)) in compiled.php line 13400
at ShareErrorsFromSessionhandle(object(Request), object(Closure))
at call_user_func_array(array(object(ShareErrorsFromSession), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9953
at PipelineIlluminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at PipelineIlluminate\Routing\{closure}(object(Request)) in compiled.php line 11943
at StartSessionhandle(object(Request), object(Closure))
at call_user_func_array(array(object(StartSession), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9953
at PipelineIlluminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at PipelineIlluminate\Routing\{closure}(object(Request)) in compiled.php line 13139
at AddQueuedCookiesToResponsehandle(object(Request), object(Closure))
at call_user_func_array(array(object(AddQueuedCookiesToResponse), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9953
at PipelineIlluminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at PipelineIlluminate\Routing\{closure}(object(Request)) in compiled.php line 13076
at EncryptCookieshandle(object(Request), object(Closure))
at call_user_func_array(array(object(EncryptCookies), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9953
at PipelineIlluminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at PipelineIlluminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in compiled.php line 9938
at Pipelinethen(object(Closure)) in compiled.php line 8219
at RouterrunRouteWithinStack(object(Route), object(Request)) in compiled.php line 8210
at RouterdispatchToRoute(object(Request)) in compiled.php line 8200
at Routerdispatch(object(Request)) in compiled.php line 2419
at KernelIlluminate\Foundation\Http\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 52
at PipelineIlluminate\Routing\{closure}(object(Request)) in compiled.php line 3286
at CheckForMaintenanceModehandle(object(Request), object(Closure))
at call_user_func_array(array(object(CheckForMaintenanceMode), 'handle'), array(object(Request), object(Closure))) in compiled.php line 9953
at PipelineIlluminate\Pipeline\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in Pipeline.php line 32
at PipelineIlluminate\Routing\{closure}(object(Request))
at call_user_func(object(Closure), object(Request)) in compiled.php line 9938
at Pipelinethen(object(Closure)) in compiled.php line 2366
at KernelsendRequestThroughRouter(object(Request)) in compiled.php line 2350
at Kernelhandle(object(Request)) in index.php line 53
ここで間違っていますか?要求ごとにエラーが発生します。
AuthController.php:
<?php
namespace App\Http\Controllers\Auth;
use App\User;
use Tymon\JWTAuth\Facades\JWTAuth;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class AuthController extends Controller
{
public function login(Request $request)
{
$credentials = $request->only('email', 'password');
try {
if (! $token = JWTAuth::attempt($credentials)) {
return response()->json(['error' => 'invalid_credentials'], 401);
}
} catch (Tymon\JWTAuth\Exceptions\JWTException $e) {
return response()->json(['error' => 'could_not_create_token'], 500);
}
return response()->json(compact('token'));
}
public function register(Request $request)
{
$user = JWTAuth::parseToken()->authenticate();
// If the token is invalid
if (!$user->isAdmin()) {
return response()->json(['error' => 'niet geautoriseerd'], 401);
}
$user = User::create([
'name' => $request->name,
'email' => $request->email,
'password' => bcrypt($request->password),
]);
return response()->json(['success' => 'gebruiker succesvol aangemaakt'], 200);
}
public function userInfo()
{
$user = JWTAuth::parseToken()->authenticate();
// If the token is invalid
if (! $user) {
return response()->json(['invalid user'], 401);
}
return response()->json([
'id' => $user->id,
'name' => $user->name,
'email' => $user->email,
'role' => $user->role
]);
}
}
これはJWT関連の問題です。あなたはあなたの認証コードを投稿できますか? 'Auth :: attempt'やそれに類するものに' Type'を渡す機会がないでしょうか? –
はい私の編集を参照してくださいと確信しています。 – Jamie
'User'モデルやマイグレーションを表示できますか? –