Create model/migration for currencies
ADD
app/Currency.php
+<?php
+
+namespace App;
+
+use Illuminate\Database\Eloquent\Model;
+
+class Currency extends Model {
+ //
+}

MODIFY
database/migrations/2014_10_12_000000_create_users_table.php
database/migrations/2014_10_12_000000_create_users_table.php
@@ -4,32 +4,19 @@ use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
-class CreateUsersTable extends Migration
-{
- /**
- * Run the migrations.
- *
- * @return void
- */
- public function up()
- {
+class CreateUsersTable extends Migration {
+ public function up() {
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
+ $table->integer('currency_id')->unsigned();
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
- $table->timestamps();
});
}
- /**
- * Reverse the migrations.
- *
- * @return void
- */
- public function down()
- {
+ public function down() {
Schema::dropIfExists('users');
}
}

ADD
database/migrations/2017_08_04_004838_create_currencies_table.php
+<?php
+
+use Illuminate\Support\Facades\Schema;
+use Illuminate\Database\Schema\Blueprint;
+use Illuminate\Database\Migrations\Migration;
+
+class CreateCurrenciesTable extends Migration {
+ public function up() {
+ Schema::create('currencies', function (Blueprint $table) {
+ $table->increments('id');
+ $table->string('name');
+ });
+ }
+
+ public function down() {
+ Schema::dropIfExists('currencies');
+ }
+}

Create model/migration for currencies