This commit is contained in:
James Brooks
2015-01-01 13:40:02 +00:00
parent 6ab16f98ab
commit a0aed6757d
3 changed files with 11 additions and 7 deletions

View File

@@ -20,6 +20,11 @@ class DashAPIController extends Controller
}
}
/**
* Updates a components ordering.
*
* @return array
*/
public function postUpdateComponentOrder()
{
$componentData = Input::all();
@@ -28,7 +33,7 @@ class DashAPIController extends Controller
foreach ($componentData['component'] as $componentId => $order) {
$component = Component::find($componentId);
$component->update([
'order' => $order
'order' => $order,
]);
}

View File

@@ -3,7 +3,8 @@
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AlterTableComponentsAddOrderColumn extends Migration {
class AlterTableComponentsAddOrderColumn extends Migration
{
/**
* Run the migrations.
@@ -12,8 +13,7 @@ class AlterTableComponentsAddOrderColumn extends Migration {
*/
public function up()
{
Schema::table('components', function(Blueprint $table)
{
Schema::table('components', function(Blueprint $table) {
$table->tinyInteger('order')->default(0)->after('status');
});
}
@@ -25,8 +25,7 @@ class AlterTableComponentsAddOrderColumn extends Migration {
*/
public function down()
{
Schema::table('components', function(Blueprint $table)
{
Schema::table('components', function(Blueprint $table) {
$table->dropColumn('order');
});
}

View File

@@ -21,7 +21,7 @@ class Component extends Eloquent implements \Dingo\Api\Transformer\Transformable
'user_id',
'tags',
'link',
'order'
'order',
];
/**