WIP: Standard backend theme page and login

Signed-off-by: Deon George <deon@leenooks.net>
This commit is contained in:
Deon George
2017-12-12 16:28:49 +11:00
parent e594ff2057
commit 33658e37a3
45 changed files with 1150 additions and 896 deletions

View File

@@ -0,0 +1,59 @@
<?php
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.
*
* @return void
*/
public function up()
{
Schema::dropIfExists('countries');
Schema::create('countries', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('twocode',2)->nullable();
$table->string('threecode',3);
$table->integer('currency_id')->unsigned()->nullable();
$table->boolean('active');
$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();
}
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('countries');
}
}