2016-12-04 2 views
1
의 요청

표를 저장누락 된 기록 Laravel

Schema::create('users', function (Blueprint $table) { 
     $table->increments('id'); 
     $table->string('name')->nullable(); 
     $table->string('email')->nullable()->unique(); 
     $table->string('password', 60); 
     $table->string('confirmation_code'); 
     $table->boolean('confirmed')->default(config('access.users.confirm_email') ? false : true); 
     $table->string('street')->nullable(); 
     $table->string('city')->nullable(); 

모델

protected $fillable = [ 
    'email', 
    'street', 
    'city',] 

컨트롤러

$user = JWTAuth::parseToken()->authenticate(); 
    $user->street = $request->street; 
    $user->city = $request->city; 
    $user->save(); 

ㅁ 내가 return response()->json($user);와 우체부 내 기능을 실행 도중 나는

{ 
"id": 5, 
"name": null, 
"email": "[email protected]", 
"status": 0, 
"confirmed": false, 
"street": "Ulloa", 
"city": null,} 

내가는 "도시"값 않는 이유

array:2 [ 
"city" => "Woodside" 
"street" => "Ulloa" 
] 

질문

는 MySQL 데이터베이스에 널 얻을 dd($request->all()) 때 얻을?

답변

1

요청시 city_ 키가 있지만 city이 아니기 때문에 $request->city이 비어 있습니다.

+0

미안하지만 입력 오류이므로 밑줄이 없습니다. – leo0019