Skip to content

Commit

Permalink
Large code cleanup and formatting of existing app code
Browse files Browse the repository at this point in the history
  • Loading branch information
Kovah committed Jul 20, 2022
1 parent 121cf4b commit b38bb3b
Show file tree
Hide file tree
Showing 31 changed files with 10 additions and 364 deletions.
4 changes: 3 additions & 1 deletion app/Http/Controllers/Models/LinkController.php
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ public function updateCheckToggle(ToggleLinkCheckRequest $request, Link $link):
return redirect()->route('links.show', ['link' => $link]);
}

public function markWorking(MarkLinkWorkingRequest $request, Link $link): RedirectResponse
public function markWorking(Link $link): RedirectResponse
{
$this->authorize('update', $link);

$link->status = Link::STATUS_OK;
$link->save();

Expand Down
8 changes: 0 additions & 8 deletions app/Http/Middleware/GuestAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,8 @@

class GuestAccess
{
/**
* Handle an incoming request.
*
* @param Request $request
* @param Closure $next
* @return mixed
*/
public function handle(Request $request, Closure $next): mixed
{
// Check for logged-in users
if (auth()->check()) {
return redirect()->route('dashboard');
}
Expand Down
9 changes: 1 addition & 8 deletions app/Http/Middleware/RedirectIfAuthenticated.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@

class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param Request $request
* @param Closure $next
* @param string|null $guard
* @return mixed
*/

public function handle(Request $request, Closure $next, $guard = null): mixed
{
if (Auth::guard($guard)->check()) {
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Requests/Auth/RegisterRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class RegisterRequest extends FormRequest
{
use PasswordValidationRules;

public function rules(Request $request): array
public function rules(): array
{
return array_merge(['token' => ['required']], CreateNewUser::rules());
}
Expand Down
15 changes: 0 additions & 15 deletions app/Http/Requests/DoImportRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,6 @@

class DoImportRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return [
Expand Down
15 changes: 0 additions & 15 deletions app/Http/Requests/Models/LinkStoreRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,6 @@

class LinkStoreRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return [
Expand Down
11 changes: 0 additions & 11 deletions app/Http/Requests/Models/LinkUpdateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ class LinkUpdateRequest extends FormRequest
{
private bool $requireUniqueUrl = false;

/**
* Determine if the user is authorized to make this request.
*
* @param Request $request
* @return bool
*/
public function authorize(Request $request): bool
{
if ($request->input('url') !== null) {
Expand All @@ -26,11 +20,6 @@ public function authorize(Request $request): bool
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
$rules = [
Expand Down
15 changes: 0 additions & 15 deletions app/Http/Requests/Models/ListStoreRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,6 @@

class ListStoreRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return [
Expand Down
11 changes: 0 additions & 11 deletions app/Http/Requests/Models/ListUpdateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ class ListUpdateRequest extends FormRequest
{
private bool $requireUniqueName = false;

/**
* Determine if the user is authorized to make this request.
*
* @param Request $request
* @return bool
*/
public function authorize(Request $request): bool
{
if ($request->input('name') !== null) {
Expand All @@ -26,11 +20,6 @@ public function authorize(Request $request): bool
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
$rules = [
Expand Down
19 changes: 0 additions & 19 deletions app/Http/Requests/Models/MarkLinkWorkingRequest.php

This file was deleted.

11 changes: 0 additions & 11 deletions app/Http/Requests/Models/NoteStoreRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,11 @@

class NoteStoreRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @param Request $request
* @return bool
*/
public function authorize(Request $request): bool
{
return $request->user()->can('view', Link::find($request->input('link_id')));
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return [
Expand Down
11 changes: 0 additions & 11 deletions app/Http/Requests/Models/NoteUpdateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,11 @@

class NoteUpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @param Request $request
* @return bool
*/
public function authorize(Request $request): bool
{
return $request->user()->can('view', $request->route('note')->link);
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return [
Expand Down
15 changes: 0 additions & 15 deletions app/Http/Requests/Models/TagStoreRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,6 @@

class TagStoreRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return [
Expand Down
11 changes: 0 additions & 11 deletions app/Http/Requests/Models/TagUpdateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@ class TagUpdateRequest extends FormRequest
{
private bool $requireUniqueName = false;

/**
* Determine if the user is authorized to make this request.
*
* @param Request $request
* @return bool
*/
public function authorize(Request $request): bool
{
if ($request->input('name') !== null) {
Expand All @@ -26,11 +20,6 @@ public function authorize(Request $request): bool
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
$rules = [
Expand Down
10 changes: 0 additions & 10 deletions app/Http/Requests/Models/ToggleLinkCheckRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,11 @@

class ToggleLinkCheckRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(Request $request): bool
{
return $request->user()->can('update', $request->link);
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return [
Expand Down
20 changes: 0 additions & 20 deletions app/Http/Requests/SearchRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,6 @@

class SearchRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return [
Expand All @@ -46,11 +31,6 @@ public function rules(): array
];
}

/**
* Specifies custom error messages for the special validations.
*
* @return array
*/
public function messages(): array
{
return [
Expand Down
15 changes: 0 additions & 15 deletions app/Http/Requests/SetupDatabaseRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,6 @@

class SetupDatabaseRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return [
Expand Down
15 changes: 0 additions & 15 deletions app/Http/Requests/SystemSettingsUpdateRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,6 @@

class SystemSettingsUpdateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize(): bool
{
return true;
}

/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return [
Expand Down
Loading

0 comments on commit b38bb3b

Please sign in to comment.