sqlite - Why NOT NULL data constraint defined with Laravel's schema builder allows NULL value being inserted when using SQLite3? -


i trying not save eloquent database models have null values. have in migration file:

$table->increments('id')->unique(); $table->string('name', 255)->unique(); $table->string('email', 255)->unique(); $table->string('password', 64); $table->timestamps(); 

the schema documentation says default value not null, ->nullable() can allow null values, cool! user model set email method looks like:

public function setemailattribute( $value )  {     if ( filter_var( $value, filter_validate_email ) )      {         $this->attributes['email'] = strtolower( $value );     }      else      {         return false;     } } 

but in testclass saves model without setting email adress!?!

$usersave3 = new user; $usersave3->setnameattribute('wronguser'); $this->assertequals( false, $usersave3->setemailattribute('wrongemail') ); $usersave3->setpasswordattribute('password'); // failed asserting true matches expected false. $this->assertequals( false, $usersave3->save() ); 

so how can add not null data constraints? using sqlite in development mode.

taylor otwell, said this bug has been fixed. in past had filed issue on github, , can see answer otwell:

i believe has been fixed.

https://github.com/laravel/framework/issues/2120#issuecomment-25551048


Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -