using laravel 4 I am trying to add 'active' column to my database to check if the user is active and is not suspended , here is my migration users table.
public function up()
{
//
Schema::create(
'users',
function (Blueprint $table) {
$table->increments('id');
$table->string('email', 300);
$table->string('password', 60);
$table->boolean('active'); // check this one
$table->string('first_name', 100);
$table->string('last_name', 100);
$table->string('address', 250)->nullable();
$table->string('city', 100)->nullable();
$table->string('state', 2)->nullable();
$table->string('zip', 5)->nullable();
$table->string('phone', 10)->nullable();
$table->timestamps();
}
);
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
//
Schema::drop('users');
}
could you help me if I use $table->boolean('active'); // check this one
*is this the right way to do it? so I can use the Auth class like this to check if the user is active or not? *
$is_active = Auth::user()->active;
if (!$is_active == 1)
{
echo "Account not activated";
}