Added page authorisation and cug processing

This commit is contained in:
Deon George
2018-12-10 22:59:02 +11:00
parent 86e29a3cee
commit 4d65bb05a1
15 changed files with 792 additions and 107 deletions

View File

@@ -16,51 +16,51 @@ class InitDatabase extends Migration
$this->down();
Schema::create('modes', function (Blueprint $table) {
$table->timestamps();
$table->integer('id')->autoIncrement();
$table->string('name',16);
$table->string('note',255);
$table->timestamps();
$table->integer('id')->autoIncrement();
$table->string('name',16);
$table->string('note',255);
$table->unique(['name']);
$table->unique(['name']);
});
Schema::create('cugs', function (Blueprint $table) {
$table->timestamps();
$table->integer('id');
$table->string('name',16);
$table->string('note',255);
$table->integer('parent_id')->nullable();
$table->timestamps();
$table->integer('id');
$table->string('name',16);
$table->string('note',255);
$table->integer('parent_id')->nullable();
$table->primary('id');
$table->foreign('parent_id')->references('id')->on('cugs');
$table->unique(['name']);
$table->primary('id');
$table->foreign('parent_id')->references('id')->on('cugs');
$table->unique(['name']);
});
Schema::create('frames', function (Blueprint $table) {
$table->timestamps();
$table->integer('id')->autoIncrement();
$table->integer('frame');
$table->char('index',1);
$table->integer('mode_id');
$table->char('type',2);
$table->smallInteger('cost')->default(0);
$table->integer('cug_id')->default(0);
$table->boolean('public')->default(FALSE);
$table->binary('content');
$table->string('note',255)->nullable();
$table->timestamps();
$table->integer('id')->autoIncrement();
$table->integer('frame');
$table->char('index',1);
$table->integer('mode_id');
$table->char('type',2);
$table->smallInteger('cost')->default(0);
$table->integer('cug_id')->default(0);
$table->boolean('public')->default(FALSE);
$table->binary('content');
$table->string('note',255)->nullable();
//$table->unique(['frame','index','mode_id']); // Not needed since we have timewarp
//$table->unique(['frame','index','mode_id']); // Not needed since we have timewarp
$table->foreign('mode_id')->references('id')->on('modes');
$table->foreign('cug_id')->references('id')->on('cugs');
$table->foreign('mode_id')->references('id')->on('modes');
$table->foreign('cug_id')->references('id')->on('cugs');
});
Schema::create('routes', function (Blueprint $table) {
$table->integer('id')->autoIncrement();
$table->char('key',1);
$table->integer('route');
$table->integer('id')->autoIncrement();
$table->char('key',1);
$table->integer('route');
$table->foreign('route')->references('id')->on('frames');
$table->foreign('route')->references('id')->on('frames');
});
}
@@ -76,4 +76,4 @@ class InitDatabase extends Migration
Schema::dropIfExists('cugs');
Schema::dropIfExists('modes');
}
}
}

View File

@@ -0,0 +1,44 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateFramemeta extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->down();
Schema::create('framemeta', function (Blueprint $table) {
$table->integer('frame_id')->primary();
$table->string('r0');
$table->string('r1');
$table->string('r2');
$table->string('r3');
$table->string('r4');
$table->string('r5');
$table->string('r6');
$table->string('r7');
$table->string('r8');
$table->string('r9');
$table->foreign('frame_id')->references('id')->on('frames');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('framemeta');
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUser extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->down();
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
$table->string('login',8)->unique();
$table->string('password');
$table->string('name');
$table->string('email')->unique();
$table->string('location');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('users');
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateUserCug extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->down();
Schema::create('cug_users', function (Blueprint $table) {
$table->integer('cug_id');
$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users');
$table->foreign('cug_id')->references('id')->on('cugs');
$table->unique(['user_id','cug_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cug_users');
}
}

View File

@@ -0,0 +1,37 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCugOwners extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->down();
Schema::create('cug_owners', function (Blueprint $table) {
$table->integer('cug_id');
$table->integer('user_id')->unsigned();
$table->foreign('user_id')->references('id')->on('users');
$table->foreign('cug_id')->references('id')->on('cugs');
$table->unique(['user_id','cug_id']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('cug_owners');
}
}

View File

@@ -0,0 +1,38 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class FrameAddAccess extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('frames', function (Blueprint $table) {
$table->renameColumn('public','closed');
$table->boolean('access')->default(FALSE);
$table->dropForeign(['cug_id']);
$table->dropColumn('cug_id');
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::table('frames', function (Blueprint $table) {
$table->dropColumn('access');
$table->renameColumn('closed','public');
$table->integer('cug_id')->default(0);
$table->foreign('cug_id')->references('id')->on('cugs');
});
}
}