Removed redundant items, upgraded to laravel 5.6

This commit is contained in:
Deon George
2018-04-10 21:23:13 +10:00
parent 33658e37a3
commit f9e3b2927a
588 changed files with 35299 additions and 90438 deletions

View File

@@ -14,12 +14,10 @@ use Faker\Generator as Faker;
*/
$factory->define(App\User::class, function (Faker $faker) {
static $password;
return [
'name' => $faker->name,
'email' => $faker->unique()->safeEmail,
'password' => $password ?: $password = bcrypt('secret'),
'password' => '$2y$10$TKh8H1.PfQx37YgCzwiKb.KjNyWgaHb9cbcoQgdIVFlYg7B77UdFm', // secret
'remember_token' => str_random(10),
];
});

View File

@@ -0,0 +1,35 @@
<?php
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()
{
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}

View File

@@ -0,0 +1,32 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreatePasswordResetsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token');
$table->timestamp('created_at')->nullable();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('password_resets');
}
}

View File

@@ -3,60 +3,40 @@
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use App\Models\Site;
class CreateTableSites extends Migration
{
private $convert = 'App\Models\Old\Setup';
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('sites');
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('sites', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->string('url');
$table->string("name");
$table->string('devurl')->nullable();
$table->text('aboutus')->nullable();
$table->json('address')->nullable();
$table->string('description')->nullable();
$table->string('email');
$table->string('phone')->nullable();
$table->string('fax')->nullable();
$table->string('logo')->nullable();
$table->string('favicon')->nullable();
$table->string('theme');
});
$table->increments('id');
$table->timestamps();
$table->string('url');
$table->string('devurl')->nullable();
$table->string('name');
$table->json('address')->nullable();
$table->string('description')->nullable();
$table->string('email');
$table->string('phone')->nullable();
$table->string('fax')->nullable();
$table->string('logo')->nullable();
$table->string('favicon')->nullable();
$table->string('theme');
});
}
if ($this->convert)
foreach (($this->convert)::all() as $o)
{
$oo = new Site;
$oo->url = rtrim($o->url,'/');
$oo->name = $o->site_details['name'];
$oo->email = $o->site_details['email'];
$oo->address = ['address1'=>$o->site_details['address1'],'address2'=>$o->site_details['address2'],'city'=>$o->site_details['city'],'state'=>$o->site_details['state'],'postcode'=>$o->site_details['pcode']];
$oo->phone = $o->site_details['phone'];
$oo->fax = $o->site_details['fax'];
$oo->theme = 'metronic-fe';
$oo->devurl = 'http://graytech';
$oo->save();
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('sites');
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('sites');
}
}

View File

@@ -3,12 +3,9 @@
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use App\Models\Currency;
class CreateTableCurrencies extends Migration
{
private $convert = 'App\Models\Old\Currency';
/**
* Run the migrations.
*
@@ -16,7 +13,6 @@ class CreateTableCurrencies extends Migration
*/
public function up()
{
Schema::dropIfExists('currencies');
Schema::create('currencies', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
@@ -24,17 +20,6 @@ class CreateTableCurrencies extends Migration
$table->string('threecode',3);
$table->boolean('active');
});
if ($this->convert)
foreach (($this->convert)::all() as $o)
{
$oo = new Currency;
$oo->name = $o->name;
$oo->symbol = $o->symbol;
$oo->threecode = $o->three_digit;
$oo->active = $o->three_code == 'AUS' ? TRUE : FALSE;
$oo->save();
}
}
/**

View File

@@ -3,12 +3,9 @@
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use App\Models\{Country,Currency};
class CreateTableCountries extends Migration
{
private $convert = 'App\Models\Old\Country';
/**
* Run the migrations.
*
@@ -16,7 +13,6 @@ class CreateTableCountries extends Migration
*/
public function up()
{
Schema::dropIfExists('countries');
Schema::create('countries', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
@@ -27,24 +23,6 @@ class CreateTableCountries extends Migration
$table->foreign('currency_id')->references('id')->on('currencies');
});
if ($this->convert)
foreach (($this->convert)::all() as $o)
{
if ($o->currency)
$co = Currency::where('name',$o->currency->name)->firstOrFail();
$oo = new Country;
$oo->name = $o->name;
$oo->twocode = $o->two_code;
$oo->threecode = $o->three_code;
$oo->active = $o->three_code == 'AUS' ? TRUE : FALSE;
if ($o->currency)
$co->countries()->save($oo);
else
$oo->save();
}
}
/**

View File

@@ -1,86 +0,0 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
use App\Models\Country;
use App\User;
class CreateTableUsers extends Migration
{
private $convert = 'App\Models\Old\Account';
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('users');
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->integer('site_id');
$table->string('email');
$table->string('password')->nullable();
$table->rememberToken();
$table->boolean('active');
$table->string('title')->nullable();
$table->string('firstname');
$table->string('lastname');
$table->integer('country_id');
$table->string('address1')->nullable();
$table->string('address2')->nullable();
$table->string('city')->nullable();
$table->string('state')->nullable();
$table->string('postcode')->nullable();
$table->boolean('emailable')->default(TRUE);
$table->unique(['site_id','email']);
});
if ($this->convert)
foreach (($this->convert)::where('id','>',0)->get() as $o)
{
$co = Country::where('name',$o->country->name)->firstOrFail();
$oo = User::where('email',$o->email)->first();
if ($oo) {
if ($oo->updated_at > date('Y-m-d H:i:s',$o->date_last))
continue;
//printf("Updating user [%s]\n",$oo->email);
} else {
$oo = new User;
//printf("New user [%s]\n",$o->email);
}
$oo->site_id = $o->site_id;
$oo->email = $o->email;
$oo->password = $o->password;
$oo->firstname = $o->first_name;
$oo->lastname = $o->last_name;
$oo->address1 = $o->address1;
$oo->address2 = $o->address2;
$oo->city = $o->city;
$oo->state = $o->state;
$oo->postcode = $o->zip;
$oo->active = $o->active;
$oo->created_at = date('Y-m-d H:i:s',$o->date_orig);
$oo->updated_at = $o->date_last ? date('Y-m-d H:i:s',$o->date_last) : NULL;
//$oo->country_id = $co->id;
$co->users()->save($oo);
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}

View File

@@ -0,0 +1,26 @@
<?php
use Illuminate\Database\Seeder;
use App\Models\{Country,Currency};
class CountryTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$o = new Country;
$o->name = 'Australia';
$o->twocode = 'AU';
$o->threecode = 'AUS';
$o->currency_id = '61';
$o->active = TRUE;
$oo = Currency::where('threecode','AUD')->firstOrFail();
$oo->countries()->save($o);
}
}

View File

@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Seeder;
use App\Models\Currency;
class CurrencyTableSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$o = new Currency;
$o->name = 'Australian Dollars';
$o->symbol = '$';
$o->threecode = 'AUD';
$o->active = TRUE;
$o->save();
}
}

View File

@@ -5,12 +5,15 @@ use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Run the database seeds.
* Seed the application's database.
*
* @return void
*/
public function run()
{
// $this->call(UsersTableSeeder::class);
$this->call([
CurrencyTableSeeder::class,
CountryTableSeeder::class
]);
}
}