Work in progress determining user type
This commit is contained in:
35
database/migrations/2018_06_22_062015_account_add_user.php
Normal file
35
database/migrations/2018_06_22_062015_account_add_user.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class AccountAddUser extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('ab_account', function (Blueprint $table) {
|
||||
// @todo Change this to not nullable
|
||||
$table->integer('user_id')->nullable()->unsigned();
|
||||
$table->foreign('user_id')->references('id')->on('users');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('ab_account', function (Blueprint $table) {
|
||||
$table->dropForeign(['user_id']);
|
||||
$table->dropColumn('user_id');
|
||||
});
|
||||
}
|
||||
}
|
34
database/migrations/2018_06_22_062022_user_add_heirachy.php
Normal file
34
database/migrations/2018_06_22_062022_user_add_heirachy.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
|
||||
class UserAddHeirachy extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function up()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->integer('parent_id')->nullable()->unsigned();
|
||||
$table->foreign('parent_id')->references('id')->on('users');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function down()
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropForeign(['parent_id']);
|
||||
$table->dropColumn('parent_id');
|
||||
});
|
||||
}
|
||||
}
|
@@ -14,10 +14,10 @@ class CountryTableSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
$o = new Country;
|
||||
$o->id = 61;
|
||||
$o->name = 'Australia';
|
||||
$o->two_code = 'AU';
|
||||
$o->three_code = 'AUS';
|
||||
$o->currency_id = '61';
|
||||
$o->active = TRUE;
|
||||
|
||||
$oo = Currency::where('iso_code','AUD')->firstOrFail();
|
||||
|
@@ -14,6 +14,7 @@ class CurrencyTableSeeder extends Seeder
|
||||
public function run()
|
||||
{
|
||||
$o = new Currency;
|
||||
$o->id = 610;
|
||||
$o->name = 'Australian Dollars';
|
||||
$o->symbol = '$';
|
||||
$o->iso_code = 'AUD';
|
||||
|
@@ -11,9 +11,13 @@ class DatabaseSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$this->call([
|
||||
CurrencyTableSeeder::class,
|
||||
CountryTableSeeder::class
|
||||
]);
|
||||
$this->call([
|
||||
CurrencyTableSeeder::class,
|
||||
CountryTableSeeder::class,
|
||||
LanguageTableSeeder::class,
|
||||
SiteTableSeeder::class,
|
||||
UserTableSeeder::class,
|
||||
RtmTableSeeder::class,
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
22
database/seeds/LanguageTableSeeder.php
Normal file
22
database/seeds/LanguageTableSeeder.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
use App\Models\Language;
|
||||
|
||||
class LanguageTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$o = new Language;
|
||||
$o->id = 1;
|
||||
$o->name = 'English';
|
||||
$o->iso = 'en_EN';
|
||||
$o->save();
|
||||
}
|
||||
}
|
23
database/seeds/RtmTableSeeder.php
Normal file
23
database/seeds/RtmTableSeeder.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
use App\Models\Rtm;
|
||||
|
||||
class RtmTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$o = new Rtm;
|
||||
$o->id = 1;
|
||||
$o->site_id = 1;
|
||||
$o->account_id = 1;
|
||||
$o->name = 'Wholesaler';
|
||||
$o->save();
|
||||
}
|
||||
}
|
24
database/seeds/SiteTableSeeder.php
Normal file
24
database/seeds/SiteTableSeeder.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
use App\Models\Site;
|
||||
|
||||
class SiteTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$o = new Site;
|
||||
$o->id = 1;
|
||||
$o->country_id = 61;
|
||||
$o->language_id = 1;
|
||||
$o->currency_id = 610;
|
||||
$o->url = 'test';
|
||||
$o->save();
|
||||
}
|
||||
}
|
71
database/seeds/UserTableSeeder.php
Normal file
71
database/seeds/UserTableSeeder.php
Normal file
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
use App\User;
|
||||
|
||||
class UserTableSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$o = new User;
|
||||
$o->id = 1;
|
||||
$o->site_id = 1;
|
||||
$o->language_id = 1;
|
||||
$o->country_id = 61;
|
||||
$o->currency_id = 610;
|
||||
$o->email = 'wholesaler@example.com';
|
||||
$o->save();
|
||||
|
||||
$o = new User;
|
||||
$o->id = 10;
|
||||
$o->site_id = 1;
|
||||
$o->language_id = 1;
|
||||
$o->country_id = 61;
|
||||
$o->currency_id = 610;
|
||||
$o->email = 'reseller1-0@example.com';
|
||||
$o->save();
|
||||
|
||||
$o = new User;
|
||||
$o->id = 11;
|
||||
$o->site_id = 1;
|
||||
$o->language_id = 1;
|
||||
$o->country_id = 61;
|
||||
$o->currency_id = 610;
|
||||
$o->email = 'reseller2-0@example.com';
|
||||
$o->save();
|
||||
|
||||
$o = new User;
|
||||
$o->id = 110;
|
||||
$o->site_id = 1;
|
||||
$o->language_id = 1;
|
||||
$o->country_id = 61;
|
||||
$o->currency_id = 610;
|
||||
$o->email = 'reseller2-1@example.com';
|
||||
$o->save();
|
||||
|
||||
$o = new User;
|
||||
$o->id = 1010;
|
||||
$o->site_id = 1;
|
||||
$o->language_id = 1;
|
||||
$o->country_id = 61;
|
||||
$o->currency_id = 610;
|
||||
$o->email = 'user1-0-1@example.com';
|
||||
$o->save();
|
||||
|
||||
$o = new User;
|
||||
$o->id = 1110;
|
||||
$o->site_id = 1;
|
||||
$o->language_id = 1;
|
||||
$o->country_id = 61;
|
||||
$o->currency_id = 610;
|
||||
$o->email = 'user2-1-1@example.com';
|
||||
$o->save();
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user