From ad6e4db85fdf14e68bb05c2e8b04bcb4bb5297d7 Mon Sep 17 00:00:00 2001 From: RiDdLeS Date: Wed, 14 May 2014 16:23:52 -0500 Subject: [PATCH 1/2] TOOLBOX-27: Testing --- app/config/queue.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) mode change 100644 => 100755 app/config/queue.php diff --git a/app/config/queue.php b/app/config/queue.php old mode 100644 new mode 100755 index 6c0fa52..0594c89 --- a/app/config/queue.php +++ b/app/config/queue.php @@ -15,7 +15,7 @@ | */ - 'default' => 'sync', + 'default' => 'iron', /* |-------------------------------------------------------------------------- @@ -50,9 +50,9 @@ 'iron' => array( 'driver' => 'iron', - 'project' => 'your-project-id', - 'token' => 'your-token', - 'queue' => 'your-queue-name', + 'project' => '535dfc8c20fa16000900007e', + 'token' => 'qqs6WTPl2nKNfPchS7sCTwS0ksk', + 'queue' => 'builder', ), 'redis' => array( From 69fe5d628b294ebcb6cf591d584c660bacb10126 Mon Sep 17 00:00:00 2001 From: RiDdLeS Date: Thu, 22 May 2014 16:41:02 -0500 Subject: [PATCH 2/2] typos and config updates --- app/controllers/HomeController.php | 18 ++++++---- app/controllers/ProjectController.php | 35 ++++++++++++++++++- ...04_28_035631_create_column_types_table.php | 1 + app/database/seeds/Build_ColumnTypeSeeder.php | 20 +++++++++++ app/models/Column.php | 16 ++++++++- app/models/Observers/BuildObserver.php | 2 +- app/models/Project.php | 10 +++--- app/start/global.php | 5 +++ app/start/local.php | 5 +++ app/views/project/view.blade.php | 2 +- 10 files changed, 98 insertions(+), 16 deletions(-) diff --git a/app/controllers/HomeController.php b/app/controllers/HomeController.php index 39c5d37..5646e3b 100755 --- a/app/controllers/HomeController.php +++ b/app/controllers/HomeController.php @@ -2,23 +2,27 @@ class HomeController extends Core_HomeController { + // Method not needed if not doing anything YOUR WRONG! -- this is true public function getIndex() { - + echo "



"; + pp(Session::all()); } - public function getTest() { + public function getTest() + { /** * Include test file then die. * this should only be accessable when debug is enabled. */ - if ( Config::get('app.debug') == true) { - include(app_path() . '/test.php'); - } else { - die('Debug mode must be enabled.'); - } + if ( Config::get('app.debug') == true) { + include(app_path('/test.php')); + } else { + throw new Exception('Debug mode must be enabled.'); + } + // Die to stop the layout from being rendered. die; } } \ No newline at end of file diff --git a/app/controllers/ProjectController.php b/app/controllers/ProjectController.php index 6c5f8e1..396ae48 100755 --- a/app/controllers/ProjectController.php +++ b/app/controllers/ProjectController.php @@ -203,8 +203,41 @@ public function postUpdateTableOrder() // return true; } - public function postUpdateColumnOrder($table, $order) + public function getDeleteColumn($columnId) { + $column = Column::with([ + 'type', + 'local', + 'local.type', + 'foreign', + 'foreign.type', + 'through', + 'through.type' + ])->find($columnId); + + $this->setViewData('column', $column); + } + + public function postDeleteColumn() + { + $input = Input::all(); + + $column = Column::find($input['columnId']); + + if ( $column->loacl->count() > 0) { + $column->local->delete(); + } + + if ( $column->foreign->count() > 0) { + $column->foreign->delete(); + } + + if ( $column->through->count() > 0) { + $column->through->delete(); + } + + $column->delete(); } + } \ No newline at end of file diff --git a/app/database/migrations/2014_04_28_035631_create_column_types_table.php b/app/database/migrations/2014_04_28_035631_create_column_types_table.php index 42576a6..1fdef2f 100755 --- a/app/database/migrations/2014_04_28_035631_create_column_types_table.php +++ b/app/database/migrations/2014_04_28_035631_create_column_types_table.php @@ -11,6 +11,7 @@ public function up() $table->increments('id'); $table->string('name', 50); $table->string('keyName', 50); + $table->integer('catagoryId')->index(); $table->timestamps(); $table->softDeletes(); }); diff --git a/app/database/seeds/Build_ColumnTypeSeeder.php b/app/database/seeds/Build_ColumnTypeSeeder.php index 0fed358..bafec92 100755 --- a/app/database/seeds/Build_ColumnTypeSeeder.php +++ b/app/database/seeds/Build_ColumnTypeSeeder.php @@ -10,101 +10,121 @@ public function run() $new = new Column_Type; $new->name = 'Increments'; $new->keyName = 'increments'; + $new->catagoryId = 1; $new->save(); $new = new Column_Type; $new->name = 'Big Increments'; $new->keyName = 'bigIncrements'; + $new->catagoryId = 1; $new->save(); $new = new Column_Type; $new->name = 'Time Stamps'; $new->keyName = 'timestamps'; + $new->catagoryId = 1; $new->save(); $new = new Column_Type; $new->name = 'Soft Deletes'; $new->keyName = 'softDeletes'; + $new->catagoryId = 1; $new->save(); $new = new Column_Type; $new->name = 'String'; $new->keyName = 'string'; + $new->catagoryId = 2; $new->save(); $new = new Column_Type; $new->name = 'Text'; $new->keyName = 'text'; + $new->catagoryId = 2; $new->save(); $new = new Column_Type; $new->name = 'Tiny Integer'; $new->keyName = 'tinyInteger'; + $new->catagoryId = 3; $new->save(); $new = new Column_Type; $new->name = 'Small Integer'; $new->keyName = 'smallInteger'; + $new->catagoryId = 3; $new->save(); $new = new Column_Type; $new->name = 'Medium Integer'; $new->keyName = 'mediumInteger'; + $new->catagoryId = 3; $new->save(); $new = new Column_Type; $new->name = 'Integer'; $new->keyName = 'integer'; + $new->catagoryId = 3; $new->save(); $new = new Column_Type; $new->name = 'Big Integer'; $new->keyName = 'bigInteger'; + $new->catagoryId = 3; $new->save(); $new = new Column_Type; $new->name = 'Float'; $new->keyName = 'float'; + $new->catagoryId = 3; $new->save(); $new = new Column_Type; $new->name = 'Decimal'; $new->keyName = 'decimal'; + $new->catagoryId = 3; $new->save(); $new = new Column_Type; $new->name = 'Boolean'; $new->keyName = 'boolean'; + $new->catagoryId = 3; $new->save(); $new = new Column_Type; $new->name = 'Enum'; $new->keyName = 'enum'; + $new->catagoryId = 4; $new->save(); $new = new Column_Type; $new->name = 'Date'; $new->keyName = 'date'; + $new->catagoryId = 6; $new->save(); $new = new Column_Type; $new->name = 'Date time'; $new->keyName = 'datetime'; + $new->catagoryId = 6; $new->save(); $new = new Column_Type; $new->name = 'Time'; $new->keyName = 'time'; + $new->catagoryId = 6; $new->save(); $new = new Column_Type; $new->name = 'Time stamp'; $new->keyName = 'timestamp'; + $new->catagoryId = 6; $new->save(); $new = new Column_Type; $new->name = 'Binary'; $new->keyName = 'binary'; + $new->catagoryId = 5; $new->save(); } } \ No newline at end of file diff --git a/app/models/Column.php b/app/models/Column.php index ba37541..3755f46 100755 --- a/app/models/Column.php +++ b/app/models/Column.php @@ -11,10 +11,24 @@ public function type() return $this->belongsTo('Column_Type', 'typeId'); } - public function table() { return $this->belongsTo('Table', 'tableId'); } + public function local() + { + return $this->hasMany('Relationship', 'localKeyId', 'id'); + } + + public function foreign() + { + return $this->hasMany('Relationship', 'foreignKeyId', 'id'); + } + + public function through() + { + return $this->hasMany('Relationship', 'throughKeyId', 'id'); + } + } \ No newline at end of file diff --git a/app/models/Observers/BuildObserver.php b/app/models/Observers/BuildObserver.php index 4371b86..a537789 100755 --- a/app/models/Observers/BuildObserver.php +++ b/app/models/Observers/BuildObserver.php @@ -1,4 +1,4 @@ -`buildMigrations($builder); $this->buildSeeds($builder); - $this->uppdateBuildStatus($builder, 'READY'); + $this->updateBuildStatus($builder, 'READY'); return true; } @@ -55,7 +55,7 @@ public function buildModels(Build $builder = null) // If the build was created by this method ready the build otherwise just exit. if ( $readyBuild == true ) { - $this->uppdateBuildStatus($builder, 'READY'); + $this->updateBuildStatus($builder, 'READY'); } return true; @@ -78,7 +78,7 @@ public function buildMigrations(Build $builder = null) // If the build was created by this method ready the build otherwise just exit. if ( $readyBuild == true ) { - $this->uppdateBuildStatus($builder, 'READY'); + $this->updateBuildStatus($builder, 'READY'); } return true; @@ -101,7 +101,7 @@ public function buildSeeds(Build $builder = null) // If the build was created by this method ready the build otherwise just exit. if ( $readyBuild == true ) { - $this->uppdateBuildStatus($builder, 'READY'); + $this->updateBuildStatus($builder, 'READY'); } return true; @@ -121,7 +121,7 @@ public function createBuildInstance() return $builder; } - public function uppdateBuildStatus(Build $builder, $status) + public function updateBuildStatus(Build $builder, $status) { $builder->status = $status; $builder->save(); diff --git a/app/start/global.php b/app/start/global.php index 3800efd..fc3f513 100755 --- a/app/start/global.php +++ b/app/start/global.php @@ -1,5 +1,10 @@ type->name }} ( {{ $column->value }} ) - + @endforeach