Removed redundant items, upgraded to laravel 5.6
This commit is contained in:
35
database/migrations/2014_10_12_000000_create_users_table.php
Normal file
35
database/migrations/2014_10_12_000000_create_users_table.php
Normal 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');
|
||||
}
|
||||
}
|
@@ -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');
|
||||
}
|
||||
}
|
@@ -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');
|
||||
}
|
||||
}
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user