How can I save the language after I have choose it?

  database-migration, laravel, laravel-localization, php

I’m building a multi language website using Laravel. To do that I used the https://github.com/mcamara/laravel-localization package. Now I want to save the language as a field at users migrations.
This is create_users_table.php:

<?php

use IlluminateDatabaseMigrationsMigration;
use IlluminateDatabaseSchemaBlueprint;
use IlluminateSupportFacadesSchema;

class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->id();
            $table->string('first_name')->nullable();
            $table->string('last_name')->nullable();
            $table->string('email')->nullable()->unique();
            $table->timestamp('email_verified_at')->nullable();
            $table->string('password')->nullable();
            $table->rememberToken();
            $table->foreignIdFor('AppModelsCompany', 'company_id')->nullable();
            $table->string('profile_photo_path')->nullable();
            $table->integer('status')->default(0); // 0-> pending, 1-> registered, 2-> profile completed
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}

Source: Laravel

Leave a Reply