Skip to content

Commit

Permalink
Simplifying routes/web.php
Browse files Browse the repository at this point in the history
  • Loading branch information
JanOppolzer committed Nov 25, 2024
1 parent b6fd704 commit 2d73115
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 186 deletions.
155 changes: 0 additions & 155 deletions app/Http/Controllers/FederationManagementController.php

This file was deleted.

5 changes: 0 additions & 5 deletions resources/views/federations/index.blade.php
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
@extends('layouts.index')
@section('title', __('common.federations'))

@section('adminOnly_action')
<x-buttons.subhead href="{{ route('federations.import') }}">{{ __('common.import') }}</x-buttons.subhead>
<x-buttons.subhead href="{{ route('federations.refresh') }}">{{ __('common.refresh') }}</x-buttons.subhead>
@endsection

@section('create')
<x-buttons.subhead href="{{ route('federations.create') }}">{{ __('common.add') }}</x-buttons.subhead>
@endsection
Expand Down
53 changes: 27 additions & 26 deletions routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,32 +56,6 @@
Route::get('fakelogout', [FakeController::class, 'destroy'])->name('fakelogout');
}

// Federation group
Route::group(['prefix' => 'federations', 'as' => 'federations.', 'middleware' => ['auth']], function () {

Route::get('import', [FederationManagementController::class, 'index'])->name('unknown');
Route::post('import', [FederationManagementController::class, 'store'])->name('import');
Route::get('refresh', [FederationManagementController::class, 'update'])->name('refresh');

Route::get('{federation}/requests', [FederationJoinController::class, 'index'])->name('requests')->withTrashed();

Route::resource('{federation}/operators', FederationOperatorController::class)->only(['index', 'store'])->withTrashed();
Route::delete('{federation}/operators', [FederationOperatorController::class, 'destroy'])->name('operators.destroy')->withTrashed();

Route::resource('{federation}/entities', FederationEntityController::class)->only(['index', 'store'])->withTrashed();
Route::delete('{federation}/entities', [FederationEntityController::class, 'destroy'])->name('entities.destroy')->withTrashed();

Route::patch('{federation}/state', [FederationStateController::class, 'state'])->name('state')->withTrashed();

Route::post('{federation}/approve', [FederationApprovalController::class, 'store'])->name('approve');
Route::delete('{federation}/reject', [FederationApprovalController::class, 'destroy'])->name('reject');

Route::resource('/', FederationController::class)->parameters(['' => 'federation'])->withTrashed();
Route::get('{federation}', [FederationController::class, 'show'])->name('show')->withTrashed();
Route::match(['put', 'patch'], '{federation}', [FederationController::class, 'update'])->name('update')->withTrashed();
Route::delete('{federation}', [FederationController::class, 'destroy'])->name('destroy')->withTrashed();
});

// Entities groups
Route::group(['prefix' => 'entities', 'as' => 'entities.', 'middleware' => ['auth']], function () {

Expand Down Expand Up @@ -122,10 +96,37 @@
});

Route::middleware('auth')->group(function () {
// Dashboard
Route::view('dashboard', 'dashboard')->name('dashboard');

// Federations
Route::post('federations/{federation}/approve', [FederationApprovalController::class, 'store'])->name('federations.approve');
Route::delete('federations/{federation}/reject', [FederationApprovalController::class, 'destroy'])->name('federations.reject');

Route::patch('federations/{federation}/state', [FederationStateController::class, 'state'])->name('federations.state')->withTrashed();

Route::get('federations/{federation}/requests', [FederationJoinController::class, 'index'])->name('federations.requests')->withTrashed();

Route::get('federations/{federation}/operators', [FederationOperatorController::class, 'index'])->name('federations.operators.index')->withTrashed();
Route::post('federations/{federation}/operators', [FederationOperatorController::class, 'store'])->name('federations.operators.store')->withTrashed();
Route::delete('federations/{federation}/operators', [FederationOperatorController::class, 'destroy'])->name('federations.operators.destroy')->withTrashed();

Route::get('federations/{federation}/entities', [FederationEntityController::class, 'index'])->name('federations.entities.index')->withTrashed();
Route::post('federations/{federation}/entities', [FederationEntityController::class, 'store'])->name('federations.entities.store')->withTrashed();
Route::delete('federations/{federation}/entities', [FederationEntityController::class, 'destroy'])->name('federations.entities.destroy')->withTrashed();

Route::resource('federations', FederationController::class)->withTrashed();

// Categories
Route::resource('categories', CategoryController::class)->only('index', 'show');

// Groups
Route::resource('groups', GroupController::class)->only('index', 'show');

// Users
Route::resource('users', UserController::class)->except('edit', 'destroy');

// Memberships
Route::resource('memberships', MembershipController::class)->only('update', 'destroy');
});

Expand Down

0 comments on commit 2d73115

Please sign in to comment.