diff --git a/app/Http/Controllers/Admin/EntityAdminController.php b/app/Http/Controllers/Admin/EntityAdminController.php index 267455c..10923c6 100644 --- a/app/Http/Controllers/Admin/EntityAdminController.php +++ b/app/Http/Controllers/Admin/EntityAdminController.php @@ -72,6 +72,7 @@ public function postNew(Request $request) $entity->part_of = $request->input('part_of'); $entity->fa_icon = $request->input('fa_icon'); $entity->contract_url = $request->input('contract') === 'yes' ? $request->input('contract_url') : null; + $entity->rank = $request->input('rank'); $entity->save(); return redirect('/admin/entities') @@ -115,6 +116,7 @@ public function postEdit($id, Request $request) $entity->part_of = $request->input('part_of'); $entity->fa_icon = $request->input('fa_icon'); $entity->contract_url = $request->input('contract') === 'yes' ? $request->input('contract_url') : null; + $entity->rank = $request->input('rank'); $entity->save(); return redirect('/admin/entities') diff --git a/app/Http/Controllers/Controller.php b/app/Http/Controllers/Controller.php index 9d20fd8..e9f2304 100644 --- a/app/Http/Controllers/Controller.php +++ b/app/Http/Controllers/Controller.php @@ -27,8 +27,10 @@ public function getIndex(Request $request) { $hidden = $request->query('hidden'); $entities = Entity::query(); + $entities->orderBy("rank"); if (!$hidden) { $entities->orWhere("id", "<>", 15); + // Tack Adam } return view('welcome') diff --git a/database/migrations/2024_09_12_180106_add_rank.php b/database/migrations/2024_09_12_180106_add_rank.php new file mode 100644 index 0000000..c418957 --- /dev/null +++ b/database/migrations/2024_09_12_180106_add_rank.php @@ -0,0 +1,32 @@ +text('rank')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('entities', function (Blueprint $table) { + $table->dropColumn('rank'); + }); + } +} diff --git a/resources/views/admin/entities/edit.blade.php b/resources/views/admin/entities/edit.blade.php index 773c4d9..44c47be 100644 --- a/resources/views/admin/entities/edit.blade.php +++ b/resources/views/admin/entities/edit.blade.php @@ -123,6 +123,18 @@ +
+ Hur högt upp ska denna entitet vara på startsidan? +
++ Hur högt upp ska denna entitet vara på startsidan? +
+