Tuesday, January 30, 2018

SQLSTATE[HY000]: General error: 1364 Field ‘user_id’ doesn’t have a default value (SQL - development

SQLSTATE[HY000]: General error: 1364 Field ‘user_id’ doesn’t have a default value (SQL

I am trying to save my data against my userid but i am getting this error.
My code is:

        AppKeys::create([
         $user = IlluminateSupportFacadesAuth::user(),
        'user_id' => $user,
        'accessTokenKey' => $accessTokenKey,
        'accessTokenSecret' => $accessTokenSecret
    ]);
    return 'You have successfully granted';

I am getting error user_id does not have default value and when i passed Auth::user()->id it says trying to get properties of non object id.

Any help would be appreciated!



from Laravel Questions and Answers https://laravelquestions.com/php/sqlstatehy000-general-error-1364-field-user_id-doesnt-have-a-default-value-sql/
via Lzo Media

No comments:

Post a Comment