Skip to content

Commit

Permalink
refactor: Make dashboard the default view
Browse files Browse the repository at this point in the history
Also:
- Refactor view folder
- Remove 'Web/Api' Controller
- Move 'User/*' Controller to Web folder
  • Loading branch information
octfx committed Dec 29, 2023
1 parent 67d9d61 commit 68332fa
Show file tree
Hide file tree
Showing 277 changed files with 1,464 additions and 2,194 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Http\Controllers\Web\User\Account;
namespace App\Http\Controllers\Web\Account;

use App\Http\Controllers\Controller;
use Illuminate\Auth\Access\AuthorizationException;
Expand Down Expand Up @@ -34,10 +34,10 @@ public function __construct()
*/
public function index()
{
$this->authorize('web.user.account.view');
$this->authorize('web.account.view');

return view(
'user.account.index',
'web.account.index',
[
'user' => Auth::user(),
]
Expand All @@ -53,7 +53,7 @@ public function index()
*/
public function update(Request $request)
{
$this->authorize('web.user.account.update');
$this->authorize('web.account.update');

Validator::validate($request->all(), [
'language' => 'required|in:en,de'
Expand All @@ -70,7 +70,7 @@ public function update(Request $request)
]
);

return redirect()->route('web.user.account.index')->withMessages(
return redirect()->route('web.account.index')->withMessages(
[
'success' => [
__('crud.updated', ['type' => __('Einstellungen')]),
Expand Down
33 changes: 0 additions & 33 deletions app/Http/Controllers/Web/Api/CommLinkController.php

This file was deleted.

30 changes: 0 additions & 30 deletions app/Http/Controllers/Web/Api/ItemController.php

This file was deleted.

35 changes: 0 additions & 35 deletions app/Http/Controllers/Web/Api/PageController.php

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Http\Controllers\Web\User\Auth;
namespace App\Http\Controllers\Web\Auth;

use App\Contracts\Web\User\AuthRepositoryInterface;
use App\Http\Controllers\Controller;
Expand Down Expand Up @@ -82,7 +82,7 @@ public function username()
*/
public function showLoginForm()
{
return view('user.auth.login');
return view('web.auth.login');
}

/**
Expand Down Expand Up @@ -144,6 +144,6 @@ public function getRedirectTo(): string
*/
protected function loggedOut(Request $request): RedirectResponse
{
return redirect()->route('web.user.auth.login');
return redirect()->route('web.auth.login');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Http\Controllers\Web\User\Changelog;
namespace App\Http\Controllers\Web\Changelog;

use App\Http\Controllers\Controller;
use App\Models\System\ModelChangelog;
Expand Down Expand Up @@ -34,7 +34,7 @@ public function __construct()
*/
public function index(Request $request)
{
$this->authorize('web.user.changelogs.view');
$this->authorize('web.changelogs.view');

$query = ModelChangelog::query()
#->where('changelog_type', '!=', ShopItem::class)
Expand All @@ -56,7 +56,7 @@ public function index(Request $request)
}

return view(
'user.changelog.index',
'web.changelog.index',
[
'changelogs' => $query->paginate($request->get('limit', 25)),
'models' => ModelChangelog::query()->select('changelog_type')->distinct()->get(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Http\Controllers\Web\User;
namespace App\Http\Controllers\Web;

use App\Http\Controllers\Controller;
use App\Models\Account\User\User;
Expand Down Expand Up @@ -41,7 +41,7 @@ public function __construct()
public function index(): View
{
$data = [];
if (Auth::user() !== null && Auth::user()->can('web.user.dashboard.view')) {
if (Auth::user() !== null && Auth::user()->can('web.dashboard.view')) {
$data = [
'users' => $this->getUserStats(),
'deepl' => $this->getDeeplStats(),
Expand All @@ -50,7 +50,7 @@ public function index(): View
}

return view(
'user.dashboard',
'web.dashboard',
$data
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Http\Controllers\Web\User\Job;
namespace App\Http\Controllers\Web\Job;

use App\Http\Controllers\Controller;
use Illuminate\Auth\Access\AuthorizationException;
Expand Down Expand Up @@ -30,9 +30,9 @@ public function __construct()
*/
public function viewFailed(): View
{
$this->authorize('web.user.jobs.view_failed');
$this->authorize('web.jobs.view_failed');

return view('user.jobs.failed_index')
return view('web.jobs.failed_index')
->with(
[
'failed' => DB::table('failed_jobs')
Expand All @@ -59,11 +59,11 @@ public function viewFailed(): View
*/
public function truncate(): RedirectResponse
{
$this->authorize('web.user.jobs.truncate');
$this->authorize('web.jobs.truncate');

DB::table('failed_jobs')->truncate();

return redirect()->route('web.user.dashboard')->withMessages(
return redirect()->route('web.dashboard')->withMessages(
[
'success' => [
__('Jobs gelöscht'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Http\Controllers\Web\User\Job\Rsi\CommLink;
namespace App\Http\Controllers\Web\Job\Rsi\CommLink;

use App\Http\Controllers\Controller;
use Illuminate\Auth\Access\AuthorizationException;
Expand All @@ -15,7 +15,7 @@
*/
class JobController extends Controller
{
private const DASHBOARD_ROUTE = 'web.user.dashboard';
private const DASHBOARD_ROUTE = 'web.dashboard';

/**
* JobController constructor.
Expand All @@ -33,7 +33,7 @@ public function __construct()
*/
public function startCommLinkTranslationJob(): RedirectResponse
{
$this->authorize('web.user.jobs.start_translation');
$this->authorize('web.jobs.start_translation');

Artisan::call('comm-links:translate', ['modifiedTime' => -1]);

Expand All @@ -53,7 +53,7 @@ public function startCommLinkTranslationJob(): RedirectResponse
*/
public function startCommLinkImageDownloadJob(): RedirectResponse
{
$this->authorize('web.user.jobs.start_image_download');
$this->authorize('web.jobs.start_image_download');

Artisan::call('comm-links:download-images');

Expand All @@ -75,7 +75,7 @@ public function startCommLinkImageDownloadJob(): RedirectResponse
*/
public function startCommLinkDownloadJob(Request $request): RedirectResponse
{
$this->authorize('web.user.jobs.start_download');
$this->authorize('web.jobs.start_download');

$data = $request->validate(
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

declare(strict_types=1);

namespace App\Http\Controllers\Web\User\Job\SC;
namespace App\Http\Controllers\Web\Job\SC;

use App\Http\Controllers\Controller;
use Illuminate\Auth\Access\AuthorizationException;
Expand All @@ -11,7 +11,7 @@

class JobController extends Controller
{
private const DASHBOARD_ROUTE = 'web.user.dashboard';
private const DASHBOARD_ROUTE = 'web.dashboard';

/**
* JobController constructor.
Expand All @@ -29,7 +29,7 @@ public function __construct()
*/
public function startItemImportJob(): RedirectResponse
{
$this->authorize('web.user.jobs.sc-import');
$this->authorize('web.jobs.sc-import');

Artisan::call('sc:import-items');

Expand All @@ -49,7 +49,7 @@ public function startItemImportJob(): RedirectResponse
*/
public function startVehicleImportJob(): RedirectResponse
{
$this->authorize('web.user.jobs.sc-import');
$this->authorize('web.jobs.sc-import');

Artisan::call('sc:import-vehicles');

Expand All @@ -69,7 +69,7 @@ public function startVehicleImportJob(): RedirectResponse
*/
public function startShopImportJob(): RedirectResponse
{
$this->authorize('web.user.jobs.sc-import');
$this->authorize('web.jobs.sc-import');

Artisan::call('sc:import-shops');

Expand All @@ -89,7 +89,7 @@ public function startShopImportJob(): RedirectResponse
*/
public function startImageUploadJob(): RedirectResponse
{
$this->authorize('web.user.jobs.sc-import');
$this->authorize('web.jobs.sc-import');

Artisan::call('sc:upload-images');

Expand All @@ -109,7 +109,7 @@ public function startImageUploadJob(): RedirectResponse
*/
public function startTranslateJob(): RedirectResponse
{
$this->authorize('web.user.jobs.sc-import');
$this->authorize('web.jobs.sc-import');

Artisan::call('sc:translate');

Expand Down
Loading

0 comments on commit 68332fa

Please sign in to comment.