This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
site-base/database/migrations/2017_12_05_015457_CreateTableSites.php
Deon George 33658e37a3
WIP: Standard backend theme page and login
Signed-off-by: Deon George <deon@leenooks.net>
2017-12-12 16:28:49 +11:00

62 lines
1.9 KiB
PHP

<?php
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');
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');
});
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');
}
}