2017-12-07 23:04:02 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
use Illuminate\Support\Facades\Schema;
|
|
|
|
use Illuminate\Database\Schema\Blueprint;
|
|
|
|
use Illuminate\Database\Migrations\Migration;
|
|
|
|
use App\Models\Site;
|
|
|
|
|
2017-12-12 05:28:49 +00:00
|
|
|
class CreateTableSites extends Migration
|
2017-12-07 23:04:02 +00:00
|
|
|
{
|
|
|
|
private $convert = 'App\Models\Old\Setup';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Run the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function up()
|
|
|
|
{
|
2017-12-12 05:28:49 +00:00
|
|
|
Schema::dropIfExists('sites');
|
|
|
|
Schema::create('sites', function (Blueprint $table) {
|
2017-12-07 23:04:02 +00:00
|
|
|
$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)
|
|
|
|
{
|
2017-12-12 05:28:49 +00:00
|
|
|
$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();
|
2017-12-07 23:04:02 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Reverse the migrations.
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function down()
|
|
|
|
{
|
2017-12-12 05:28:49 +00:00
|
|
|
Schema::dropIfExists('sites');
|
2017-12-07 23:04:02 +00:00
|
|
|
}
|
2017-12-12 05:28:49 +00:00
|
|
|
}
|