I am using Laravel's pre-build Auth code. I have another table submissions which looks like this
Schema::create( 'submissions', function( Blueprint $table ) {
$table->increments( 'id' );
$table->enum( 'complete', [ 'yes', 'no' ] );
$table->string( 'formName' );
$table->timestamps();
// Reference to User ID but only when submitted by a registered user...
//$table->integer( 'user_id' )->unsigned();
//$table->foreign( 'user_id' )->references( 'id' )->on( 'users' );
$table->integer( 'status_id' )->unsigned();
$table->foreign( 'status_id' )->references( 'id' )->on( 'status' );
});
When a submission is by a registered user I would like to reference that user id, But anonymous submissions are possible and I need some indicator that the submission is by an anonymous user.
should I?
- creating an actual users records for an anon user
- change my user_id foreign key to allow NULL values to indicate the anon user
or is there a better way?
Thanks
via Nathan