1
0
mirror of https://github.com/devcode-it/openstamanager.git synced 2025-03-12 17:20:08 +01:00

refactor: ♻️ Refactoring completo del codice

This commit is contained in:
Maicol Battistini 2023-05-07 17:02:00 +02:00
parent c5ff6ac8fd
commit 4ff43648f1
No known key found for this signature in database
90 changed files with 404 additions and 543 deletions

View File

@ -16,6 +16,7 @@ ij_visual_guides = none
ij_wrap_on_typing = false
[*.blade.php]
max_line_length = 160
ij_blade_keep_indents_on_empty_lines = false
[*.css]
@ -179,7 +180,7 @@ ij_xml_space_around_equals_in_attribute = false
ij_xml_space_inside_empty_tag = false
ij_xml_text_wrap = normal
[{*.ats,*.cts,*.mts,*.ts}]
[{*.ats,*.cts,*.mts,*.ts,*.tsx}]
indent_size = 2
max_line_length = 200
tab_width = 2

View File

@ -1,7 +1,7 @@
<component name="ProjectCodeStyleConfiguration">
<code_scheme name="Project" version="173">
<option name="LINE_SEPARATOR" value="&#10;" />
<option name="RIGHT_MARGIN" value="140" />
<option name="RIGHT_MARGIN" value="160" />
<JSCodeStyleSettings version="0">
<option name="FORCE_SEMICOLON_STYLE" value="true" />
<option name="USE_DOUBLE_QUOTES" value="false" />

6
.idea/codeception.xml generated
View File

@ -15,6 +15,12 @@
<Configuration>
<option name="path" value="$PROJECT_DIR$/tests" />
</Configuration>
<Configuration>
<option name="path" value="$PROJECT_DIR$/tests" />
</Configuration>
<Configuration>
<option name="path" value="$PROJECT_DIR$/tests" />
</Configuration>
</list>
</option>
</component>

View File

@ -8,8 +8,6 @@
<inspection_tool class="BreakStatementJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="BreakStatementWithLabelJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ChainedEqualityJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ClassNameCollisionInspection" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="ClassOverridesFieldOfSuperClassInspection" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CoffeeScriptFunctionSignatures" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="CoffeeScriptInfiniteLoop" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CoffeeScriptLiteralNotFunction" enabled="true" level="ERROR" enabled_by_default="true" />
@ -37,6 +35,9 @@
<inspection_tool class="CssConvertColorToHexInspection" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CssMissingSemicolon" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="CssNonIntegerLengthInPixels" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="CssUnusedSymbol" enabled="true" level="WARNING" enabled_by_default="true">
<scope name="App" level="WARNING" enabled="false" />
</inspection_tool>
<inspection_tool class="CyclomaticComplexityJS" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_limit" value="10" />
</inspection_tool>
@ -56,7 +57,7 @@
<inspection_tool class="EmptyDirectory" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="EmptyFinallyBlockJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="EmptyTryBlockJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="Eslint" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" editorAttributes="WARNING_ATTRIBUTES">
<option name="useSeverityFromConfigFile" value="false" />
</inspection_tool>
<inspection_tool class="FixedTimeStartWithInspection" enabled="true" level="WARNING" enabled_by_default="true" />
@ -141,9 +142,10 @@
<option name="m_maxLength" value="64" />
</inspection_tool>
<inspection_tool class="FunctionWithInconsistentReturnsJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="GrazieInspection" enabled="true" level="TYPO" enabled_by_default="true" />
<inspection_tool class="GrazieInspection" enabled="true" level="TYPO" enabled_by_default="true">
<scope name="App" level="TYPO" enabled="false" />
</inspection_tool>
<inspection_tool class="HamlNestedTagContent" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="HtmlNonExistentInternetResource" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="HtmlPresentationalElement" enabled="true" level="INFORMATION" enabled_by_default="true" />
<inspection_tool class="HtmlRequiredSummaryAttribute" enabled="true" level="INFORMATION" enabled_by_default="true" />
<inspection_tool class="HtmlRequiredTitleAttribute" enabled="true" level="INFORMATION" enabled_by_default="true" />
@ -174,7 +176,7 @@
<inspection_tool class="HtmlUnknownTag" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myValues">
<value>
<list size="10">
<list size="20">
<item index="0" class="java.lang.String" itemvalue="nobr" />
<item index="1" class="java.lang.String" itemvalue="noembed" />
<item index="2" class="java.lang.String" itemvalue="comment" />
@ -185,6 +187,16 @@
<item index="7" class="java.lang.String" itemvalue="md-fab" />
<item index="8" class="java.lang.String" itemvalue="md-icon" />
<item index="9" class="java.lang.String" itemvalue="mwc-snackbar" />
<item index="10" class="java.lang.String" itemvalue="md-checkbox" />
<item index="11" class="java.lang.String" itemvalue="md-filled-text-field" />
<item index="12" class="java.lang.String" itemvalue="md-outlined-text-field" />
<item index="13" class="java.lang.String" itemvalue="md-navigation-drawer-modal" />
<item index="14" class="java.lang.String" itemvalue="md-navigation-drawer" />
<item index="15" class="java.lang.String" itemvalue="md-list-item" />
<item index="16" class="java.lang.String" itemvalue="md-list-item-link" />
<item index="17" class="java.lang.String" itemvalue="md-list" />
<item index="18" class="java.lang.String" itemvalue="top-app-bar" />
<item index="19" class="java.lang.String" itemvalue="md-branded-fab" />
</list>
</value>
</option>
@ -216,6 +228,13 @@
<inspection_tool class="JSNonStrictModeUsed" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="JSUnfilteredForInLoop" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="JSUnresolvedReactComponent" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="JSUnusedGlobalSymbols" enabled="true" level="WARNING" enabled_by_default="true">
<scope name="App" level="WARNING" enabled="false" />
</inspection_tool>
<inspection_tool class="JSUnusedLocalSymbols" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myIgnoreUnusedFunctionParameters" value="true" />
<option name="myIgnoreParametersBeforeUsed" value="false" />
</inspection_tool>
<inspection_tool class="JSXNamespaceValidation" enabled="false" level="WEAK WARNING" enabled_by_default="false">
<option name="requiredNamespace" value="m" />
</inspection_tool>
@ -228,8 +247,8 @@
</inspection_tool>
<inspection_tool class="LongInheritanceChainInspection" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="LongLine" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="MessDetectorValidationInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="MethodShouldBeFinalInspection" enabled="false" level="WARNING" enabled_by_default="false" />
<inspection_tool class="MethodVisibilityInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="NegatedConditionalExpressionJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="NegatedIfStatementJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="NestedAssignmentJS" enabled="true" level="WARNING" enabled_by_default="true" />
@ -271,14 +290,20 @@
<option name="CUSTOM_RULESET_PATH" value="$PROJECT_DIR$/.php-cs-fixer.php" />
<option name="ALLOW_RISKY_RULES" value="true" />
</inspection_tool>
<inspection_tool class="PhpCSValidationInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpClassConstantAccessedViaChildClassInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="PhpClassHasTooManyDeclaredMembersInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpClassNamingConventionInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpClassNamingConventionInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="m_maxLength" value="32" />
</inspection_tool>
<inspection_tool class="PhpComplexClassInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpComplexFunctionInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpCompoundNamespaceDepthInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpConstantNamingConventionInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpConstantNamingConventionInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="m_minLength" value="4" />
</inspection_tool>
<inspection_tool class="PhpDynamicAsStaticMethodCallInspection" enabled="true" level="WARNING" enabled_by_default="true">
<option name="SHOW_FOR_MAGIC" value="false" />
</inspection_tool>
<inspection_tool class="PhpFeatureEnvyLocalInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpFunctionCyclomaticComplexityInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpFunctionNamingConventionInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
@ -286,27 +311,36 @@
<inspection_tool class="PhpLackOfCohesionInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpLongTypeFormInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpMemberCanBePulledUpInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpMethodNamingConventionInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpMethodNamingConventionInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="m_minLength" value="2" />
<option name="m_maxLength" value="32" />
</inspection_tool>
<inspection_tool class="PhpMethodOrClassCallIsNotCaseSensitiveInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpMissingDocCommentInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="CHECK_CLASS" value="false" />
</inspection_tool>
<inspection_tool class="PhpMissingParentCallCommonInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpMissingParentCallMagicInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpMissingVisibilityInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpModifierOrderInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpNewClassMissingParameterListInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpNonCanonicalElementsOrderInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpOverridingMethodVisibilityInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpPropertyNamingConventionInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpPropertyNamingConventionInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="m_minLength" value="3" />
</inspection_tool>
<inspection_tool class="PhpSeparateElseIfInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpStanGlobal" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpStaticAsDynamicMethodCallInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpStaticAsDynamicMethodCallInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<option name="SHOW_FOR_MAGIC" value="false" />
</inspection_tool>
<inspection_tool class="PhpTooManyParametersInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpTraditionalSyntaxArrayLiteralInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpTraitsUseListInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpUndefinedCallbackInspection" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="PhpUnnecessaryDoubleQuotesInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpUnused" enabled="true" level="WEAK WARNING" enabled_by_default="true">
<scope name="App" level="WEAK WARNING" enabled="false" />
</inspection_tool>
<inspection_tool class="PhpUsageOfSilenceOperatorInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpVarUsageInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="PhpVariableNamingConventionInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true">
@ -383,15 +417,27 @@
</option>
</inspection_tool>
<inspection_tool class="ShortEchoTagCanBeUsedInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="SpellCheckingInspection" enabled="true" level="TYPO" enabled_by_default="true">
<scope name="App" level="TYPO" enabled="false">
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</scope>
<option name="processCode" value="true" />
<option name="processLiterals" value="true" />
<option name="processComments" value="true" />
</inspection_tool>
<inspection_tool class="SqlGotoInspection" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SqlMissingColumnAliasesInspection" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="SqlNamedArgumentsInspection" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="StandardJS" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="StatementsPerFunctionJS" enabled="true" level="WARNING" enabled_by_default="true">
<option name="m_limit" value="30" />
</inspection_tool>
<inspection_tool class="StringCurlyInspection" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
<inspection_tool class="StringLiteralBreaksHTMLJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="Style" enabled="true" level="TYPO" enabled_by_default="true">
<scope name="App" level="TYPO" enabled="false" />
</inspection_tool>
<inspection_tool class="Stylelint" enabled="true" level="ERROR" enabled_by_default="true" />
<inspection_tool class="TailRecursionJS" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="TextLabelInSwitchStatementJS" enabled="true" level="WARNING" enabled_by_default="true" />
@ -411,7 +457,6 @@
<option name="m_ignoreCatchBlocksWithComments" value="false" />
</inspection_tool>
<inspection_tool class="UnusedDefine" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UsingInclusionReturnValueInspection" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
<inspection_tool class="W3CssValidation" enabled="true" level="WARNING" enabled_by_default="true">
<option name="myCssVersion" value="css3svg" />
<option name="myIgnoreVendorSpecificProperties" value="false" />

6
.idea/phpspec.xml generated
View File

@ -14,6 +14,12 @@
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
<PhpSpecSuiteConfiguration>
<option name="myPath" value="$PROJECT_DIR$" />
</PhpSpecSuiteConfiguration>
</suites>
</component>
</project>

2
.idea/phpunit.xml generated
View File

@ -8,6 +8,8 @@
<option value="$PROJECT_DIR$/tests" />
<option value="$PROJECT_DIR$/tests" />
<option value="$PROJECT_DIR$/tests" />
<option value="$PROJECT_DIR$/tests" />
<option value="$PROJECT_DIR$/tests" />
</list>
</option>
</component>

3
.idea/scopes/App.xml generated Normal file
View File

@ -0,0 +1,3 @@
<component name="DependencyValidationManager">
<scope name="App" pattern="file[osm3]:app//*||file[osm3]:resources//*||file[osm3]:routes//*||file[osm3]:config//*||file[osm3]:database//*" />
</component>

View File

@ -1,3 +0,0 @@
<component name="DependencyValidationManager">
<scope name="Frontend" pattern="file[osm3]:resources/ts/*.ts||file[osm3]:resources/ts/*.tsx" />
</component>

View File

@ -15,7 +15,7 @@ class CreateNewUser implements CreatesNewUsers
/**
* Validate and create a newly registered user.
*
* @param array<string, string> $input
* @param array<array-key, mixed> $input
*/
public function create(array $input): User
{

View File

@ -9,7 +9,9 @@ trait PasswordValidationRules
/**
* Get the validation rules used to validate passwords.
*
* @return array<int, \Illuminate\Contracts\Validation\Rule|array|string>
* @return list{'required', 'string', Password, 'confirmed'}'
*
* @noinspection PhpDocSignatureInspection
*/
protected function passwordRules(): array
{

View File

@ -29,8 +29,8 @@ class UpdateUserProfileInformation implements UpdatesUserProfileInformation
],
])->validateWithBag('updateProfileInformation');
if ($input['email'] !== $user->email &&
$user instanceof MustVerifyEmail) {
if ($input['email'] !== $user->email && $user instanceof MustVerifyEmail) {
/** @noinspection PhpParamsInspection */
$this->updateVerifiedUser($user, $input);
} else {
$user->forceFill([

View File

@ -1,5 +1,7 @@
<?php
/** @noinspection PropertyInitializationFlawsInspection */
namespace App\Console;
use Illuminate\Console\Scheduling\Schedule;
@ -12,9 +14,7 @@ class Kernel extends ConsoleKernel
*
* @var array
*/
protected $commands = [
//
];
protected $commands = [];
/**
* Define the application's command schedule.

View File

@ -1,5 +1,7 @@
<?php
/** @noinspection PropertyInitializationFlawsInspection */
namespace App\Exceptions;
use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
@ -10,16 +12,14 @@ class Handler extends ExceptionHandler
/**
* A list of the exception types that are not reported.
*
* @var array
* @var array<int, class-string<Throwable>>
*/
protected $dontReport = [
//
];
protected $dontReport = [];
/**
* A list of the inputs that are never flashed for validation exceptions.
*
* @var array
* @var array<int, string>
*/
protected $dontFlash = [
'current_password',
@ -33,7 +33,6 @@ class Handler extends ExceptionHandler
public function register(): void
{
$this->reportable(static function (Throwable $e): void {
//
});
}
}

View File

@ -14,15 +14,14 @@ use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
use function in_array;
use Jackiedo\DotenvEditor\DotenvEditor;
use PDOException;
use RuntimeException;
use function in_array;
class SetupController extends Controller
{
public function __construct(private \Jackiedo\DotenvEditor\DotenvEditor $dotenvEditor)
public function __construct(private readonly DotenvEditor $dotenvEditor)
{
}
@ -74,6 +73,13 @@ class SetupController extends Controller
// Identifying permissions granted to the user
$database_name = Str::replace('_', '\_', $database_name);
/**
* @psalm-suppress InvalidArgument
*
* @noinspection PhpParamsInspection
*
* @phpstan-ignore-next-line
*/
$grants = $connection->select($connection->raw('SHOW GRANTS FOR CURRENT_USER'));
$requirements = [

View File

@ -1,80 +0,0 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Validation\ValidationException;
use JetBrains\PhpStorm\ArrayShape;
class AuthController extends Controller
{
// /**
// * Handle an authentication attempt.
// */
// public function login(Request $request): JsonResponse|Response
// {
// try {
// $request->validate($this->rules($request));
// } catch (ValidationException $e) {
// return response()->json(['message' => $e->getMessage(), 'errors' => $e->errors()], Response::HTTP_UNPROCESSABLE_ENTITY);
// }
//
// $credentials = $request->only(['username', 'password']);
//
// // TODO: Rivedere con Laravel 10
// if (filter_var($request->get('username'), FILTER_VALIDATE_EMAIL)) {
// $credentials['email'] = $credentials['username'];
// unset($credentials['username']);
// }
//
// if (auth()->attempt($credentials, $request->get('remember') === 'on')) {
// $request->session()->regenerate();
// if ($request->hasSession()) {
// $request->session()->put('auth.password_confirmed_at', time());
// }
//
// return response()->noContent();
// }
//
// return response()->json([
// 'message' => __('Le credenziali non sono valide.')
// ], Response::HTTP_BAD_REQUEST);
// }
/**
* Log the user out of the application.
*
* @noinspection RepetitiveMethodCallsInspection
*/
public function logout(Request $request): Response
{
auth()->logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return response()->noContent();
}
// /**
// * @return array{username: string, password: string, remember: string}
// */
// #[ArrayShape(['username' => 'string', 'password' => 'string', 'remember' => 'string'])]
// private function rules(Request $request): array
// {
// $additional_validation = '';
// $db_field = 'username';
// if (filter_var($request->input('username'), FILTER_VALIDATE_EMAIL)) {
// $additional_validation = '|email';
// $db_field = 'email';
// }
//
// return [
// 'username' => "required|string|exists:users,$db_field|$additional_validation",
// 'password' => 'required|string',
// 'remember' => 'string|in:on',
// ];
// }
}

View File

@ -13,7 +13,9 @@ use Illuminate\Http\Request;
use Illuminate\Routing\Controller as BaseController;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\File;
use Illuminate\Support\ServiceProvider;
use ReflectionClass;
use ReflectionException;
class Controller extends BaseController
{
@ -38,7 +40,7 @@ class Controller extends BaseController
}
/**
* @return Collection<string>
* @return Collection<int, string>
*/
public static function getLanguages(): Collection
{
@ -48,7 +50,7 @@ class Controller extends BaseController
}
/**
* @return Collection<array{
* @return Collection<string, array{
* name: string,
* description: string,
* slug: string,
@ -63,9 +65,15 @@ class Controller extends BaseController
{
return collect(app()->getLoadedProviders())
->keys()
->filter(static fn (string $provider) => (new ReflectionClass($provider))->isSubclassOf(ModuleServiceProvider::class))
->filter(
/**
* @param class-string $provider
*
* @throws ReflectionException
*/
static fn (string $provider) => (new ReflectionClass($provider))->isSubclassOf(ModuleServiceProvider::class))
->map(static fn (string $provider) => app()->getProvider($provider))
->mapWithKeys(static fn (ModuleServiceProvider $provider) => [$provider::slug() => [
->mapWithKeys(static fn (?ServiceProvider $provider) => $provider instanceof ModuleServiceProvider ? [$provider::slug() => [
'name' => $provider::name(),
'description' => $provider::description(),
'slug' => $provider::slug(),
@ -74,6 +82,6 @@ class Controller extends BaseController
'url' => $provider::url(),
'modulePath' => $provider::modulePath(),
'namespace' => $provider::namespace(),
]]);
]] : []);
}
}

View File

@ -1,66 +0,0 @@
<?php
namespace App\Http\Controllers;
use App\Models\User;
use Illuminate\Auth\Events\PasswordReset;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Password;
use Illuminate\Support\Str;
use Illuminate\Validation\ValidationException;
class PasswordController extends Controller
{
// public function forgotPassword(Request $request): Response|JsonResponse
// {
// try {
// $request->validate([
// 'email' => 'required|email|exists:users,email',
// ]);
// } catch (ValidationException $e) {
// return response()->json([
// 'message' => $e->getMessage(),
// 'errors' => $e->errors(),
// ], Response::HTTP_UNPROCESSABLE_ENTITY);
// }
//
// $response = Password::broker()->sendResetLink($request->input('email'));
//
// return $response === Password::RESET_LINK_SENT
// ? response()->noContent()
// : \response()->json(['message' => __($response)], Response::HTTP_UNPROCESSABLE_ENTITY);
// }
//
// public function resetPassword(Request $request): JsonResponse|Response
// {
// try {
// $request->validate([
// 'token' => 'required|string',
// 'email' => 'required|email|exists:users,email',
// 'password' => ['required|string|confirmed', \Illuminate\Validation\Rules\Password::defaults()],
// ]);
// } catch (ValidationException $e) {
// return response()->json([
// 'message' => $e->getMessage(),
// 'errors' => $e->errors(),
// ], Response::HTTP_UNPROCESSABLE_ENTITY);
// }
//
// $response = Password::broker()->reset(
// $request->only(['email', 'password', 'password_confirmation', 'token']),
// static function (User $user, string $password): void {
// $user->password = Hash::make($password);
// $user->setRememberToken(Str::random(60));
// $user->save();
// event(new PasswordReset($user));
// }
// );
//
// return $response === Password::PASSWORD_RESET
// ? response()->noContent()
// : response()->json(['message' => __($response)], Response::HTTP_UNPROCESSABLE_ENTITY);
// }
}

View File

@ -1,5 +1,9 @@
<?php
/** @noinspection PhpPropertyNamingConventionInspection */
/** @noinspection EfferentObjectCouplingInspection */
namespace App\Http;
use App\Http\Middleware\Authenticate;
@ -36,7 +40,7 @@ class Kernel extends HttpKernel
*
* These middlewares are run during every request to your application.
*
* @var array
* @var array<int, string>
*/
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
@ -51,7 +55,7 @@ class Kernel extends HttpKernel
/**
* The application's route middleware groups.
*
* @var array
* @var array<string, array<int, string>>
*/
protected $middlewareGroups = [
'web' => [
@ -79,9 +83,9 @@ class Kernel extends HttpKernel
*
* These middlewares may be assigned to a group or used individually.
*
* @var array
* @var array<string, string>
*/
protected $routeMiddleware = [
protected $middlewareAliases = [
'auth' => Authenticate::class,
'auth.basic' => AuthenticateWithBasicAuth::class,
'cache.headers' => SetCacheHeaders::class,

View File

@ -12,6 +12,10 @@ class Authenticate extends Middleware
*/
protected function redirectTo(Request $request): ?string
{
return $request->expectsJson() ? null : route('login');
if ($request->expectsJson()) {
return null;
}
return route('login');
}
}

View File

@ -11,6 +11,7 @@ use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\DB;
use InvalidArgumentException;
use PDO;
use PDOException;
class CheckConfigurationMiddleware
@ -18,8 +19,8 @@ class CheckConfigurationMiddleware
public function handle(Request $request, Closure $next): Response|RedirectResponse|JsonResponse
{
$checks = [
'database' => fn () => !empty(DB::connection()->getDatabaseName()) && DB::connection()->getPdo(),
'admin_user' => fn () => !empty(User::exists()),
'database' => static fn (): bool => !empty(DB::connection()->getDatabaseName()) && DB::connection()->getPdo() instanceof PDO,
'admin_user' => static fn (): bool => !empty(User::exists()),
];
foreach ($checks as $check) {
@ -34,13 +35,16 @@ class CheckConfigurationMiddleware
}
if (!$check) {
if (str_starts_with($request->route()?->getName(), 'setup.')) {
$route = $request->route();
if ($route && str_starts_with($route->getName(), 'setup.')) {
return $next($request);
}
return $request->wantsJson()
? \response()->json(['message' => __('Configurazione del database richiesta')], Response::HTTP_SERVICE_UNAVAILABLE)
: redirect()->route('setup.index');
if ($request->wantsJson()) {
return \response()->json(['message' => __('Configurazione del database richiesta')], Response::HTTP_SERVICE_UNAVAILABLE);
}
return redirect()->route('setup.index');
}
}

View File

@ -1,5 +1,7 @@
<?php
/** @noinspection PropertyInitializationFlawsInspection */
namespace App\Http\Middleware;
use Illuminate\Cookie\Middleware\EncryptCookies as Middleware;
@ -9,9 +11,7 @@ class EncryptCookies extends Middleware
/**
* The names of the cookies that should not be encrypted.
*
* @var array
* @var array<int, string>
*/
protected $except = [
//
];
protected $except = [];
}

View File

@ -1,10 +1,13 @@
<?php
/** @noinspection PropertyInitializationFlawsInspection */
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Illuminate\Support\Arr;
use Inertia\Middleware;
use JetBrains\PhpStorm\ArrayShape;
class HandleInertiaRequests extends Middleware
{
@ -22,10 +25,9 @@ class HandleInertiaRequests extends Middleware
*
* @see https://inertiajs.com/shared-data
*/
#[ArrayShape([0 => 'array|\Closure[]', 'locale' => Closure::class])]
final public function share(Request $request): array
{
return array_merge(parent::share($request), [
'locale' => static fn() => app()->getLocale(),
]);
return [...parent::share($request), 'locale' => static fn () => app()->getLocale()];
}
}

View File

@ -1,5 +1,7 @@
<?php
/** @noinspection PropertyInitializationFlawsInspection */
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\PreventRequestsDuringMaintenance as Middleware;
@ -9,9 +11,7 @@ class PreventRequestsDuringMaintenance extends Middleware
/**
* The URIs that should be reachable while maintenance mode is enabled.
*
* @var array
* @var array<int, string>
*/
protected $except = [
//
];
protected $except = [];
}

View File

@ -12,11 +12,10 @@ class RedirectIfAuthenticated
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next, string ...$guards): Response
{
/** @noinspection CallableParameterUseCaseInTypeContextInspection */
$guards = empty($guards) ? [null] : $guards;
foreach ($guards as $guard) {

View File

@ -10,7 +10,7 @@ class TrustProxies extends Middleware
/**
* The trusted proxies for this application.
*
* @var array|string|null
* @var array<int, string>|string|null
*/
protected $proxies;

View File

@ -1,5 +1,7 @@
<?php
/** @noinspection PropertyInitializationFlawsInspection */
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as Middleware;
@ -9,9 +11,7 @@ class VerifyCsrfToken extends Middleware
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
* @var array<int, string>
*/
protected $except = [
//
];
protected $except = [];
}

View File

@ -2,7 +2,6 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Laravel\Sanctum\HasApiTokens;
@ -11,14 +10,13 @@ use Rawilk\Settings\Models\HasSettings;
class User extends Authenticatable
{
use HasSettings;
use HasFactory;
use Notifiable;
use HasApiTokens;
/**
* The attributes that are mass assignable.
*
* @var array
* @var array<string>
*/
protected $fillable = [
'username',
@ -29,7 +27,7 @@ class User extends Authenticatable
/**
* The attributes that should be hidden for arrays.
*
* @var array
* @var array<string>
*/
protected $hidden = [
'password',

View File

@ -5,6 +5,8 @@ namespace App;
use Illuminate\Support\Arr;
use Illuminate\Support\ServiceProvider;
use ReflectionClass;
use function dirname;
use function in_array;
abstract class ModuleServiceProvider extends ServiceProvider
{
@ -30,15 +32,29 @@ abstract class ModuleServiceProvider extends ServiceProvider
return static::$description;
}
/**
* @psalm-suppress InvalidNullableReturnType
*/
public static function slug(): string
{
$slug = static::$slug;
if (empty($slug)) {
$cachedPackages = require app()->getCachedPackagesPath();
$slug = array_key_first(Arr::where($cachedPackages, static fn (array $package) => in_array(static::class, $package['providers'], true)));
/**
* @psalm-suppress UnresolvableInclude
*/
$cached_packages = require app()->getCachedPackagesPath();
$slug = array_key_first(
Arr::where(
$cached_packages,
static fn (array $package) => in_array(static::class, $package['providers'], true)
)
);
static::$slug = $slug;
}
/**
* @psalm-suppress NullableReturnStatement
*/
return $slug;
}

View File

@ -1,5 +1,7 @@
<?php
/** @noinspection PhpUnusedParameterInspection */
namespace App\Policies;
use App\Models\User;
@ -9,12 +11,12 @@ class UserPolicy
{
use HandlesAuthorization;
public function allowRestify(User $user = null): bool
public function allowRestify(?User $user = null): bool
{
return true;
}
public function show(User $user = null, User $model): bool
public function show(?User $user, User $model): bool
{
return true;
}

View File

@ -27,6 +27,6 @@ class AppServiceProvider extends ServiceProvider
public function boot(Controller $controller): void
{
view()->share('modules', $controller->getModules());
Vite::macro('image', fn ($asset) => Vite::asset("resources/images/$asset"));
Vite::macro('image', fn (string $asset) => Vite::asset("resources/images/$asset"));
}
}

View File

@ -1,16 +1,17 @@
<?php
/** @noinspection PropertyInitializationFlawsInspection */
namespace App\Providers;
use Illuminate\Foundation\Support\Providers\AuthServiceProvider as ServiceProvider;
use Illuminate\Support\Facades\Gate;
class AuthServiceProvider extends ServiceProvider
{
/**
* The policy mappings for the application.
*
* @var array
* @var array<class-string, class-string>
*/
protected $policies = [
// 'App\Models\Model' => 'App\Policies\ModelPolicy',
@ -23,6 +24,5 @@ class AuthServiceProvider extends ServiceProvider
{
$this->registerPolicies();
//
}
}

View File

@ -11,7 +11,7 @@ class EventServiceProvider extends ServiceProvider
/**
* The event listener mappings for the application.
*
* @var array
* @var array<string, array<int, string>>
*/
protected $listen = [
Registered::class => [
@ -24,6 +24,5 @@ class EventServiceProvider extends ServiceProvider
*/
public function boot(): void
{
//
}
}

View File

@ -2,10 +2,7 @@
namespace App\Providers;
use App\Actions\Fortify\CreateNewUser;
use App\Actions\Fortify\ResetUserPassword;
use App\Actions\Fortify\UpdateUserPassword;
use App\Actions\Fortify\UpdateUserProfileInformation;
use App\Models\User;
use Illuminate\Cache\RateLimiting\Limit;
use Illuminate\Http\Request;
@ -21,7 +18,6 @@ class FortifyServiceProvider extends ServiceProvider
*/
public function register(): void
{
}
/**
@ -30,11 +26,11 @@ class FortifyServiceProvider extends ServiceProvider
public function boot(): void
{
Fortify::authenticateUsing(static function (Request $request) {
$user = User::where('email', $request->username)
->orWhere('username', $request->username)
$user = User::where('email', $request->input('username')
->orWhere('username', $request->input('username')))
->first();
if ($user && Hash::check($request->password, $user->password)) {
if ($user && Hash::check($request->input('password'), $user->password)) {
return $user;
}
@ -45,13 +41,13 @@ class FortifyServiceProvider extends ServiceProvider
// Fortify::updateUserPasswordsUsing(UpdateUserPassword::class);
Fortify::resetUserPasswordsUsing(ResetUserPassword::class);
RateLimiter::for('login', function (Request $request) {
$email = (string) $request->email;
RateLimiter::for('login', static function (Request $request) {
$email = (string) $request->input('email');
return Limit::perMinute(5)->by($email.$request->ip());
return Limit::perMinute(5)->by($email.((string) $request->ip()));
});
RateLimiter::for('two-factor', function (Request $request) {
RateLimiter::for('two-factor', static function (Request $request) {
return Limit::perMinute(5)->by($request->session()->get('login.id'));
});
}

View File

@ -3,6 +3,7 @@
namespace App\Providers;
use App\Http\Controllers\Controller;
use App\Models\User;
use Binaryk\LaravelRestify\Restify;
use Binaryk\LaravelRestify\RestifyApplicationServiceProvider;
use Illuminate\Support\Facades\Gate;
@ -13,10 +14,13 @@ class RestifyServiceProvider extends RestifyApplicationServiceProvider
* Register the Restify gate.
*
* This gate determines who can access Restify in non-local environments.
*
* @noinspection MissingParentCallInspection
* @noinspection PhpUnusedParameterInspection
*/
protected function gate(): void
{
Gate::define('viewRestify', function ($user) {
Gate::define('viewRestify', static function (User $user) {
return true;
});
}
@ -28,7 +32,9 @@ class RestifyServiceProvider extends RestifyApplicationServiceProvider
// Register repositories from modules
$modules = app(Controller::class)->getModules();
foreach ($modules as $module) {
Restify::repositoriesFrom($module['modulePath'].DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'Api', $module['namespace'].'\Api\\');
Restify::repositoriesFrom(
$module['modulePath'].DIRECTORY_SEPARATOR.'src'.DIRECTORY_SEPARATOR.'Api', $module['namespace'].'\Api\\'
);
}
}
}

View File

@ -19,15 +19,6 @@ class RouteServiceProvider extends ServiceProvider
*/
public const HOME = '/dashboard';
/**
* The controller namespace for the application.
*
* When present, controller route declarations will automatically be prefixed with this namespace.
*
* @var string|null
*/
// protected $namespace = 'App\\Http\\Controllers';
/**
* Define your route model bindings, pattern filters, etc.
*/
@ -52,6 +43,6 @@ class RouteServiceProvider extends ServiceProvider
*/
protected function configureRateLimiting(): void
{
RateLimiter::for('api', static fn(Request $request) => Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip()));
RateLimiter::for('api', static fn (Request $request) => Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()));
}
}

View File

@ -2,11 +2,9 @@
namespace App\Restify;
use Binaryk\LaravelRestify\Filters\Filter;
use Binaryk\LaravelRestify\Filters\MatchFilter;
use Binaryk\LaravelRestify\Http\Requests\RestifyRequest;
use Binaryk\LaravelRestify\Repositories\Repository as RestifyRepository;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Relations\Relation;
abstract class Repository extends RestifyRepository
{
@ -14,41 +12,8 @@ abstract class Repository extends RestifyRepository
public static array $match = ['id'];
/**
* Build a "show" and "index" query for the given repository.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
*/
public static function mainQuery(RestifyRequest $request, Builder|Relation $query)
{
return $query;
}
/**
* Build an "index" query for the given repository.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
*/
public static function indexQuery(RestifyRequest $request, Builder|Relation $query)
{
return $query;
}
/**
* Build a "show" query for the given repository.
*
* @param \Illuminate\Database\Eloquent\Builder $query
* @return \Illuminate\Database\Eloquent\Builder
*/
public static function showQuery(RestifyRequest $request, Builder|Relation $query)
{
return $query;
}
public static function matches(): array
{
return array_map(static fn (string $type) => MatchFilter::make()->setType($type)->partial(), static::$match);
return array_map(static fn (string $type): Filter => MatchFilter::make()->setType($type)->partial(), static::$match);
}
}

View File

@ -20,9 +20,9 @@ class UserRepository extends Repository
{
return [
field('username')->rules('required'),
field('email')->storingRules('required', 'unique:users')->updatingRules('unique:users'),
field('created_at')->label('createdAt')->readOnly(),
field('updated_at')->label('updatedAt')->readOnly(),
field('email')->storingRules(['required', 'unique:users'])->updatingRules('unique:users'),
field('created_at')->label('createdAt')->readonly(),
field('updated_at')->label('updatedAt')->readonly(),
];
}
}

View File

@ -53,6 +53,7 @@
"friendsofphp/php-cs-fixer": "^3",
"fumeapp/modeltyper": "^2.1",
"glhd/laravel-dumper": "^1",
"jetbrains/phpstorm-attributes": "@dev",
"laravel-lang/attributes": "^2",
"laravel-lang/lang": "^12",
"laravel-lang/publisher": "^14",

View File

@ -10,7 +10,6 @@ return [
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', 'Laravel'),
@ -36,7 +35,6 @@ return [
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => (bool) env('APP_DEBUG', false),
@ -64,7 +62,6 @@ return [
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => 'Europe/Rome',
@ -76,7 +73,7 @@ return [
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
| to any of the locales, which will be supported by the application.
|
*/
@ -175,7 +172,7 @@ return [
App\Providers\EventServiceProvider::class,
App\Providers\RestifyServiceProvider::class,
App\Providers\RouteServiceProvider::class,
\App\Providers\FortifyServiceProvider::class,
App\Providers\FortifyServiceProvider::class,
],
@ -186,12 +183,11 @@ return [
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
| the aliases are "lazy" loaded, so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Arr' => Illuminate\Support\Arr::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
@ -232,7 +228,5 @@ return [
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'Vite' => Illuminate\Support\Facades\Vite::class,
],
];

View File

@ -25,7 +25,7 @@ return [
|
| Next, you may define every authentication guard for your application.
| Of course, a great default configuration has been defined for you
| here which uses session storage and the Eloquent user provider.
| here, which uses session storage and the Eloquent user provider.
|
| All authentication drivers have a user provider. This defines how the
| users are actually retrieved out of your database or other storage
@ -57,8 +57,8 @@ return [
| users are actually retrieved out of your database or other storage
| mechanisms used by this application to persist your user's data.
|
| If you have multiple user tables or models you may configure multiple
| sources which represent each model / table. These sources may then
| If you have multiple user tables or models, you may configure multiple
| sources, which represent each model / table. These sources may then
| be assigned to any extra authentication guards you have defined.
|
| Supported: "database", "eloquent"
@ -83,13 +83,13 @@ return [
|--------------------------------------------------------------------------
|
| You may specify multiple password reset configurations if you have more
| than one user table or model in the application and you want to have
| than one user table or model in the application, and you want to have
| separate password reset settings based on the specific user types.
|
| The expire time is the number of minutes that the reset token should be
| considered valid. This security feature keeps tokens short-lived so
| they have less time to be guessed. You may change this as needed.
|
| The expiry time is the number of minutes that the reset token should be
| considered valid.
| This security feature keeps tokens short-lived, so they have less time to be guessed.
| You may change this as needed.
*/
'passwords' => [
@ -109,7 +109,6 @@ return [
| Here you may define the amount of seconds before a password confirmation
| times out and the user is prompted to re-enter their password via the
| confirmation screen. By default, the timeout lasts for three hours.
|
*/
'password_timeout' => 10800,

View File

@ -101,7 +101,7 @@ return [
|
| When utilizing a RAM based store such as APC or Memcached, there might
| be other applications utilizing the same cache. So, we'll specify a
| value to get prefixed to all our keys so we can avoid collisions.
| value to get prefixed to all our keys, so we can avoid collisions.
|
*/

View File

@ -24,7 +24,7 @@ return [
|
| Here are each of the database connections setup for your application.
| Of course, examples of configuring each database platform that is
| supported by Laravel is shown below to make development simple.
| supported by Laravel are shown below to make development simple.
|
|
| All database work in Laravel is done through the PHP PDO facilities
@ -101,7 +101,6 @@ return [
| This table keeps track of all the migrations that have already run for
| your application. Using this information, we can determine which of
| the migrations on disk haven't actually been run in the database.
|
*/
'migrations' => 'migrations',
@ -114,7 +113,6 @@ return [
| Redis is an open source, fast, and advanced key-value store that also
| provides a richer body of commands than a typical key-value system
| such as APC or Memcached. Laravel makes it easy to dig right in.
|
*/
'redis' => [

View File

@ -10,7 +10,6 @@ return [
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
@ -22,7 +21,7 @@ return [
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
| been set up for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
@ -63,7 +62,6 @@ return [
| Here you may configure the symbolic links that will be created when the
| `storage:link` Artisan command is executed. The array keys should be
| the locations of the links and the values should be their targets.
|
*/
'links' => [

View File

@ -47,7 +47,7 @@ return [
'user_verify_url' => env('FRONTEND_APP_URL').'/verify/{id}/{emailHash}',
'user_model' => "\App\Models\User",
'user_model' => App\Models\User::class,
],
/*

View File

@ -12,7 +12,7 @@ return new class() extends Migration
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
Schema::table('users', static function (Blueprint $table) {
$table->text('two_factor_secret')
->after('password')
->nullable();
@ -34,13 +34,10 @@ return new class() extends Migration
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(array_merge([
'two_factor_secret',
'two_factor_recovery_codes',
], Fortify::confirmsTwoFactorAuthentication() ? [
Schema::table('users', static function (Blueprint $table) {
$table->dropColumn(['two_factor_secret', 'two_factor_recovery_codes', ...Fortify::confirmsTwoFactorAuthentication() ? [
'two_factor_confirmed_at',
] : []));
] : []]);
});
}
};

View File

@ -11,7 +11,7 @@ return new class() extends Migration
*/
public function up(): void
{
Schema::create('personal_access_tokens', function (Blueprint $table) {
Schema::create('personal_access_tokens', static function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->string('name');

View File

@ -8,12 +8,10 @@ return new class() extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
public function up(): void
{
Schema::create('action_logs', function (Blueprint $table) {
Schema::create('action_logs', static function (Blueprint $table) {
$table->id();
$table->char('batch_id', 36);
$table->unsignedBigInteger('user_id')->index()->nullable();
@ -39,10 +37,8 @@ return new class() extends Migration
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
public function down(): void
{
Schema::dropIfExists('action_logs');
}

View File

@ -1,14 +1,18 @@
<?xml version="1.0"?>
<!--suppress XmlDefaultAttributeValue -->
<psalm
errorLevel="7"
resolveFromConfigFile="true"
errorLevel="4"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="app"/>
<directory name="database"/>
<directory name="resources/views"/>
<directory name="routes"/>
<ignoreFiles>
<directory name="vendor"/>
</ignoreFiles>

View File

@ -1,15 +1,15 @@
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20010904//EN"
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
"http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd">
<svg version="1.0" xmlns="http://www.w3.org/2000/svg"
width="1041.000000pt" height="1041.000000pt" viewBox="0 0 1041.000000 1041.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.14, written by Peter Selinger 2001-2017
</metadata>
<g transform="translate(0.000000,1041.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M4429 10318 c-1 -7 -2 -232 -3 -500 0 -267 -4 -489 -8 -493 -5 -6
width="1041.000000pt" height="1041.000000pt" viewBox="0 0 1041.000000 1041.000000"
preserveAspectRatio="xMidYMid meet">
<metadata>
Created by potrace 1.14, written by Peter Selinger 2001-2017
</metadata>
<g transform="translate(0.000000,1041.000000) scale(0.100000,-0.100000)"
fill="#000000" stroke="none">
<path d="M4429 10318 c-1 -7 -2 -232 -3 -500 0 -267 -4 -489 -8 -493 -5 -6
-97 -27 -254 -60 -18 -4 -243 -71 -317 -95 -23 -7 -29 -6 -34 8 -4 9 -27 51
-51 92 -24 41 -60 104 -80 140 -19 36 -41 72 -48 81 -8 8 -14 18 -14 21 0 3
-43 79 -95 168 -52 89 -95 163 -95 165 0 3 -100 175 -106 183 -2 3 -49 -22
@ -61,5 +61,5 @@ c137 238 249 433 247 434 -2 2 -463 268 -562 325 -33 19 -69 40 -80 46 -11 7
400 -6z m1515 -3298 c16 -1 15 -4 -5 -33 -108 -151 -270 -323 -403 -429 -168
-133 -382 -258 -566 -328 -92 -36 -298 -95 -369 -106 -353 -55 -671 -42 -965
42 -436 124 -836 394 -1108 748 -69 89 -75 101 -56 105 16 4 3402 5 3472 1z"/>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

View File

@ -9,15 +9,14 @@ md-icon svg {
}
:is(md-list-item, md-list-item-link) md-icon {
padding-left: 16px;
--md-icon-color: var(--_list-item-leading-icon-color);
// TODO: MD Tokens sets the icon size to 18px, but the list item icon is 24px per the specs.
//svg {
//width: var(--_list-item-leading-icon-size, var(--_with-icon-icon-size, var(--_icon-size, var(--_size))));
//height: var(--_list-item-leading-icon-size, var(--_with-icon-icon-size, var(--_icon-size, var(--_size))));
// line-height: 0;
//}
padding-left: 16px;
svg {
width: var(--_list-item-leading-icon-size, var(--_with-icon-icon-size, var(--_icon-size, var(--_size))));
height: var(--_list-item-leading-icon-size, var(--_with-icon-icon-size, var(--_icon-size, var(--_size))));
}
}
label:has(> md-checkbox) {
@ -30,32 +29,35 @@ md-filled-text-field, md-outlined-text-field {
}
md-navigation-drawer, md-navigation-drawer-modal {
//--mdc-theme-surface: var(--md-sys-color-background, #fff);
//--mdc-theme-primary: var(--mdc-theme-primary2, variables.$primary);
//noinspection Stylelint
> md-list {
display: flex;
justify-content: center;
md-list-item-link {
display: block;
width: 85%;
--md-list-item-list-item-container-shape: 100px;
--md-ripple-shape: 100px;
//--md-focus-ring-shape-start-start: 100px;
//--md-focus-ring-shape-start-end: 100px;
//--md-focus-ring-shape-end-start: 100px;
//--md-focus-ring-shape-end-end: 100px;
display: block;
width: 85%;
&[active] {
--md-list-item-list-item-container-color: var(--md-sys-color-secondary-container, #3f51b5);
}
md-icon[slot="start"] svg {
// TODO: Waiting for token implementation in Material Web
// (see https://m3.material.io/components/navigation-drawer/specs#ce8bfbcf-3dec-45d2-9d8b-5e10af1cf87d)
width: 24px;
height: 24px;
}
}
}
}
top-app-bar {
--mdc-theme-primary: var(--md-sys-color-surface, #fff);
--mdc-theme-on-primary: var(--md-sys-color-on-surface, #5f6368);
width: 100%;
[slot="navigationIcon"], [slot="title"] {
@ -65,9 +67,6 @@ top-app-bar {
[slot="actionItems"] {
--md-icon-color: var(--md-sys-color-on-surface-variant, #5f6368);
}
--mdc-theme-primary: var(--md-sys-color-surface, #fff);
--mdc-theme-on-primary: var(--md-sys-color-on-surface, #5f6368);
}
md-fab, md-branded-fab {

View File

@ -1,3 +1,3 @@
// Font
$headings_font: "Montserrat, sans-serif";
$body_font: "Nunito, sans-serif";
$heading-font: "Montserrat, sans-serif";
$body-font: "Nunito, sans-serif";

View File

@ -18,19 +18,13 @@ body {
}
#app {
min-height: 100vh;
display: grid;
grid-template-rows: 1fr auto;
}
.center-block {
display: block;
margin: 0 auto;
min-height: 100vh;
}
.center-logo {
@extend .center-block;
display: block;
width: fit-content;
max-width: 100%;
margin: 0 auto;
@ -41,29 +35,27 @@ body {
flex-direction: column;
align-items: center;
justify-content: center;
box-sizing: border-box;
height: 100%;
padding: 16px;
box-sizing: border-box;
}
.ext-card {
--md-card-padding: 16px;
margin-top: 48px;
@include media.media(">desktop") {
max-width: 55vw;
}
margin-top: 48px;
}
.setup-buttons, .login-buttons {
display: flex;
justify-content: space-around;
margin: 16px 0;
@include media.media("<=tablet") {
&:has(:nth-child(3)) {
flex-direction: column;
flex-wrap: wrap;
flex-flow: column wrap;
gap: 16px;
& > * {
@ -71,30 +63,16 @@ body {
}
}
}
display: flex;
justify-content: space-around;
margin: 16px 0;
}
.flag {
width: 32px;
}
.stretch {
//noinspection CssInvalidPropertyValue
width: stretch;
}
.logo-bg-sticky {
position: fixed;
z-index: 1;
top: 60%;
right: -15%;
width: 500px;
opacity: 0.1;
}
.record-dialog {
--mdc-layout-grid-margin-desktop: 0;
}
.user-image {
width: 150px;
border-radius: 50%;
@ -109,12 +87,15 @@ body {
--------------------------- */
footer {
display: flex;
width: 100%;
padding-top: 10px;
padding-bottom: 10px;
background-color: var(--md-sys-color-surface, white);
color: var(--md-sys-color-on-surface, #000);
background-color: var(--md-sys-color-surface, white);
> :first-child {
flex: 1;
padding-left: 16px;
@ -124,6 +105,4 @@ footer {
padding-right: 16px;
text-align: right;
}
//--mdc-theme-primary: #{variables.$primary};
}

View File

@ -7,8 +7,8 @@
body {
@extend .body-large;
background-color: var(--md-sys-color-background, #fff);
color: var(--md-sys-color-on-background);
background-color: var(--md-sys-color-background, #fff);
}
small {
@ -26,31 +26,31 @@ $headings: (
@each $selector, $class in $headings {
#{$selector} {
color: var(--md-sys-color-on-surface);
@extend .#{$class};
color: var(--md-sys-color-on-surface);
}
}
a {
border-radius: 4px;
color: var(--md-sys-color-primary);
text-decoration: underline;
border-radius: 4px;
&:hover {
color: var(--md-sys-color-on-primary-container);
}
&:focus {
border: 1px solid var(--md-sys-color-primary);
margin: -1px;
box-shadow: inset 0 0 0 1px var(--md-sys-color-surface);
border: 1px solid var(--md-sys-color-primary);
outline: 0;
box-shadow: inset 0 0 0 1px var(--md-sys-color-surface);
}
&:hover:focus {
border: 1px solid var(--md-sys-color-on-primary-container);
color: var(--md-sys-color-on-primary-container);
border: 1px solid var(--md-sys-color-on-primary-container);
outline: 0;
}
}

View File

@ -1,4 +1,7 @@
:root {
$headlines-font-family: 'Plus Jakarta Sans';
$body-font-family: 'Kantumruy Pro';
--md-source: #e8a80f;
/* primary */
@ -173,9 +176,7 @@
--md-sys-color-outline-variant-dark: #4e4639;
--md-sys-color-scrim-dark: #000;
$headlines-font-family: 'Plus Jakarta Sans';
$body-font-family: 'Kantumruy Pro';
/* typography */
--md-ref-typeface-brand: #{$headlines-font-family};
--md-ref-typeface-plain: #{$body-font-family};

View File

@ -1,164 +1,164 @@
.display-large {
font-family: var(--md-sys-typescale-display-large-font-family-name);
font-size: var(--md-sys-typescale-display-large-font-size);
font-style: var(--md-sys-typescale-display-large-font-family-style);
font-weight: var(--md-sys-typescale-display-large-font-weight);
letter-spacing: var(--md-sys-typescale-display-large-tracking);
font-style: var(--md-sys-typescale-display-large-font-family-style);
line-height: var(--md-sys-typescale-display-large-height);
text-decoration: var(--md-sys-typescale-display-large-text-decoration);
text-transform: var(--md-sys-typescale-display-large-text-transform);
letter-spacing: var(--md-sys-typescale-display-large-tracking);
}
.display-medium {
font-family: var(--md-sys-typescale-display-medium-font-family-name);
font-size: var(--md-sys-typescale-display-medium-font-size);
font-style: var(--md-sys-typescale-display-medium-font-family-style);
font-weight: var(--md-sys-typescale-display-medium-font-weight);
letter-spacing: var(--md-sys-typescale-display-medium-tracking);
font-style: var(--md-sys-typescale-display-medium-font-family-style);
line-height: var(--md-sys-typescale-display-medium-height);
text-decoration: var(--md-sys-typescale-display-medium-text-decoration);
text-transform: var(--md-sys-typescale-display-medium-text-transform);
letter-spacing: var(--md-sys-typescale-display-medium-tracking);
}
.display-small {
font-family: var(--md-sys-typescale-display-small-font-family-name);
font-size: var(--md-sys-typescale-display-small-font-size);
font-style: var(--md-sys-typescale-display-small-font-family-style);
font-weight: var(--md-sys-typescale-display-small-font-weight);
letter-spacing: var(--md-sys-typescale-display-small-tracking);
font-style: var(--md-sys-typescale-display-small-font-family-style);
line-height: var(--md-sys-typescale-display-small-height);
text-decoration: var(--md-sys-typescale-display-small-text-decoration);
text-transform: var(--md-sys-typescale-display-small-text-transform);
letter-spacing: var(--md-sys-typescale-display-small-tracking);
}
.headline-large {
font-family: var(--md-sys-typescale-headline-large-font-family-name);
font-size: var(--md-sys-typescale-headline-large-font-size);
font-style: var(--md-sys-typescale-headline-large-font-family-style);
font-weight: var(--md-sys-typescale-headline-large-font-weight);
letter-spacing: var(--md-sys-typescale-headline-large-tracking);
font-style: var(--md-sys-typescale-headline-large-font-family-style);
line-height: var(--md-sys-typescale-headline-large-height);
text-decoration: var(--md-sys-typescale-headline-large-text-decoration);
text-transform: var(--md-sys-typescale-headline-large-text-transform);
letter-spacing: var(--md-sys-typescale-headline-large-tracking);
}
.headline-medium {
font-family: var(--md-sys-typescale-headline-medium-font-family-name);
font-size: var(--md-sys-typescale-headline-medium-font-size);
font-style: var(--md-sys-typescale-headline-medium-font-family-style);
font-weight: var(--md-sys-typescale-headline-medium-font-weight);
letter-spacing: var(--md-sys-typescale-headline-medium-tracking);
font-style: var(--md-sys-typescale-headline-medium-font-family-style);
line-height: var(--md-sys-typescale-headline-medium-height);
text-decoration: var(--md-sys-typescale-headline-medium-text-decoration);
text-transform: var(--md-sys-typescale-headline-medium-text-transform);
letter-spacing: var(--md-sys-typescale-headline-medium-tracking);
}
.headline-small {
font-family: var(--md-sys-typescale-headline-small-font-family-name);
font-size: var(--md-sys-typescale-headline-small-font-size);
font-style: var(--md-sys-typescale-headline-small-font-family-style);
font-weight: var(--md-sys-typescale-headline-small-font-weight);
letter-spacing: var(--md-sys-typescale-headline-small-tracking);
font-style: var(--md-sys-typescale-headline-small-font-family-style);
line-height: var(--md-sys-typescale-headline-small-height);
text-decoration: var(--md-sys-typescale-headline-small-text-decoration);
text-transform: var(--md-sys-typescale-headline-small-text-transform);
letter-spacing: var(--md-sys-typescale-headline-small-tracking);
}
.body-large {
font-family: var(--md-sys-typescale-body-large-font-family-name);
font-size: var(--md-sys-typescale-body-large-font-size);
font-style: var(--md-sys-typescale-body-large-font-family-style);
font-weight: var(--md-sys-typescale-body-large-font-weight);
letter-spacing: var(--md-sys-typescale-body-large-tracking);
font-style: var(--md-sys-typescale-body-large-font-family-style);
line-height: var(--md-sys-typescale-body-large-height);
text-decoration: var(--md-sys-typescale-body-large-text-decoration);
text-transform: var(--md-sys-typescale-body-large-text-transform);
letter-spacing: var(--md-sys-typescale-body-large-tracking);
}
.body-medium {
font-family: var(--md-sys-typescale-body-medium-font-family-name);
font-size: var(--md-sys-typescale-body-medium-font-size);
font-style: var(--md-sys-typescale-body-medium-font-family-style);
font-weight: var(--md-sys-typescale-body-medium-font-weight);
letter-spacing: var(--md-sys-typescale-body-medium-tracking);
font-style: var(--md-sys-typescale-body-medium-font-family-style);
line-height: var(--md-sys-typescale-body-medium-height);
text-decoration: var(--md-sys-typescale-body-medium-text-decoration);
text-transform: var(--md-sys-typescale-body-medium-text-transform);
letter-spacing: var(--md-sys-typescale-body-medium-tracking);
}
.body-small {
font-family: var(--md-sys-typescale-body-small-font-family-name);
font-size: var(--md-sys-typescale-body-small-font-size);
font-style: var(--md-sys-typescale-body-small-font-family-style);
font-weight: var(--md-sys-typescale-body-small-font-weight);
letter-spacing: var(--md-sys-typescale-body-small-tracking);
font-style: var(--md-sys-typescale-body-small-font-family-style);
line-height: var(--md-sys-typescale-body-small-height);
text-decoration: var(--md-sys-typescale-body-small-text-decoration);
text-transform: var(--md-sys-typescale-body-small-text-transform);
letter-spacing: var(--md-sys-typescale-body-small-tracking);
}
.label-large {
font-family: var(--md-sys-typescale-label-large-font-family-name);
font-size: var(--md-sys-typescale-label-large-font-size);
font-style: var(--md-sys-typescale-label-large-font-family-style);
font-weight: var(--md-sys-typescale-label-large-font-weight);
letter-spacing: var(--md-sys-typescale-label-large-tracking);
font-style: var(--md-sys-typescale-label-large-font-family-style);
line-height: var(--md-sys-typescale-label-large-height);
text-decoration: var(--md-sys-typescale-label-large-text-decoration);
text-transform: var(--md-sys-typescale-label-large-text-transform);
letter-spacing: var(--md-sys-typescale-label-large-tracking);
}
.label-medium {
font-family: var(--md-sys-typescale-label-medium-font-family-name);
font-size: var(--md-sys-typescale-label-medium-font-size);
font-style: var(--md-sys-typescale-label-medium-font-family-style);
font-weight: var(--md-sys-typescale-label-medium-font-weight);
letter-spacing: var(--md-sys-typescale-label-medium-tracking);
font-style: var(--md-sys-typescale-label-medium-font-family-style);
line-height: var(--md-sys-typescale-label-medium-height);
text-decoration: var(--md-sys-typescale-label-medium-text-decoration);
text-transform: var(--md-sys-typescale-label-medium-text-transform);
letter-spacing: var(--md-sys-typescale-label-medium-tracking);
}
.label-small {
font-family: var(--md-sys-typescale-label-small-font-family-name);
font-size: var(--md-sys-typescale-label-small-font-size);
font-style: var(--md-sys-typescale-label-small-font-family-style);
font-weight: var(--md-sys-typescale-label-small-font-weight);
letter-spacing: var(--md-sys-typescale-label-small-tracking);
font-style: var(--md-sys-typescale-label-small-font-family-style);
line-height: var(--md-sys-typescale-label-small-height);
text-decoration: var(--md-sys-typescale-label-small-text-decoration);
text-transform: var(--md-sys-typescale-label-small-text-transform);
letter-spacing: var(--md-sys-typescale-label-small-tracking);
}
.title-large {
font-family: var(--md-sys-typescale-title-large-font-family-name);
font-size: var(--md-sys-typescale-title-large-font-size);
font-style: var(--md-sys-typescale-title-large-font-family-style);
font-weight: var(--md-sys-typescale-title-large-font-weight);
letter-spacing: var(--md-sys-typescale-title-large-tracking);
font-style: var(--md-sys-typescale-title-large-font-family-style);
line-height: var(--md-sys-typescale-title-large-height);
text-decoration: var(--md-sys-typescale-title-large-text-decoration);
text-transform: var(--md-sys-typescale-title-large-text-transform);
letter-spacing: var(--md-sys-typescale-title-large-tracking);
}
.title-medium {
font-family: var(--md-sys-typescale-title-medium-font-family-name);
font-size: var(--md-sys-typescale-title-medium-font-size);
font-style: var(--md-sys-typescale-title-medium-font-family-style);
font-weight: var(--md-sys-typescale-title-medium-font-weight);
letter-spacing: var(--md-sys-typescale-title-medium-tracking);
font-style: var(--md-sys-typescale-title-medium-font-family-style);
line-height: var(--md-sys-typescale-title-medium-height);
text-decoration: var(--md-sys-typescale-title-medium-text-decoration);
text-transform: var(--md-sys-typescale-title-medium-text-transform);
letter-spacing: var(--md-sys-typescale-title-medium-tracking);
}
.title-small {
font-family: var(--md-sys-typescale-title-small-font-family-name);
font-size: var(--md-sys-typescale-title-small-font-size);
font-style: var(--md-sys-typescale-title-small-font-family-style);
font-weight: var(--md-sys-typescale-title-small-font-weight);
letter-spacing: var(--md-sys-typescale-title-small-tracking);
font-style: var(--md-sys-typescale-title-small-font-family-style);
line-height: var(--md-sys-typescale-title-small-height);
text-decoration: var(--md-sys-typescale-title-small-text-decoration);
text-transform: var(--md-sys-typescale-title-small-text-transform);
letter-spacing: var(--md-sys-typescale-title-small-tracking);
}

View File

@ -6,7 +6,6 @@ import {
mdiPageFirst,
mdiPageLast
} from '@mdi/js';
import MdIcon from '@osm/Components/MdIcon';
import {
Children,

View File

@ -5,7 +5,6 @@ import {
mdiArrowDown,
mdiArrowUp
} from '@mdi/js';
import MdIcon from '@osm/Components/MdIcon';
import {Vnode} from 'mithril';
import {

View File

@ -9,7 +9,6 @@ import {
} from '@maicol07/material-web-additions/data-table/lib/data-table';
import {DataTableCell} from '@maicol07/material-web-additions/data-table/lib/data-table-cell';
import {mdiDeleteOutline} from '@mdi/js';
import DataTable, {DataTableAttributes} from '@osm/Components/DataTable/DataTable';
import DataTableColumn, {DataTableColumnAttributes} from '@osm/Components/DataTable/DataTableColumn';
import RecordsTableColumn from '@osm/Components/DataTable/RecordsTableColumn';
@ -86,9 +85,14 @@ export default class RecordsTable<M extends Model<any, any>, A extends RecordsTa
columns.put('checkbox', <md-data-table-column key="checkbox" type="checkbox"></md-data-table-column>);
}
// noinspection NestedFunctionJS
function isDataTableColumn(column: Vnode<Record<string, any>>): boolean {
return (typeof column.tag !== 'string' && (column.tag as Class<any>).prototype instanceof DataTableColumn);
}
columns = columns.merge(vnode.attrs.cols.map<Children>((column: Children | RecordsTableColumnAttributes, attribute: string) => {
// If the column is a vnode, and it is a DataTableColumn or a string that matches the tag name of a DataTableColumn, then use it as is.
if (isVnode<Record<string, any>>(column) && (column.tag === 'md-data-table-column' || (typeof column.tag !== 'string' && (column.tag as Class<any>).prototype instanceof DataTableColumn))) {
if (isVnode<Record<string, any>>(column) && (column.tag === 'md-data-table-column' || isDataTableColumn(column))) {
column.key ??= attribute;
column.attrs['data-model-attribute'] ??= attribute;
return column;
@ -123,6 +127,7 @@ export default class RecordsTable<M extends Model<any, any>, A extends RecordsTa
noRecordsContent(vnode: Vnode<A>): Children {
const colspan = vnode.attrs.cols.count() + (vnode.attrs.selectable ? 1 : 0) + (vnode.attrs.readonly ? 0 : 1);
// noinspection JSXDomNesting
return (
<md-data-table-row>
<td colspan={colspan} style={{textAlign: 'center'}}>{__('Nessun record trovato')}</td>

View File

@ -1,5 +1,4 @@
import {mdiFloppy} from '@mdi/js';
import RecordDialog, {RecordDialogAttributes} from '@osm/Components/Dialogs/RecordDialog';
import MdIcon from '@osm/Components/MdIcon';
import Model from '@osm/Models/Model';
@ -14,8 +13,8 @@ import {
Vnode,
VnodeDOM
} from 'mithril';
import {Form} from 'mithril-utilities';
import Stream from 'mithril/stream';
import {Form} from 'mithril-utilities';
import {Class} from 'type-fest';
export default abstract class AddEditRecordDialog<M extends Model<any, any>> extends RecordDialog<M> {

View File

@ -8,16 +8,16 @@ import {
Vnode,
VnodeDOM
} from 'mithril';
import Stream from 'mithril/stream';
import {
Attributes,
Component
} from 'mithril-utilities';
import Stream from 'mithril/stream';
export interface DialogAttributes extends Attributes, Partial<Pick<MDDialog,
'fullscreen' | 'fullscreenBreakpoint' | 'footerHidden' | 'stacked' | 'defaultAction' |
'actionAttribute' | 'focusAttribute' | 'scrimClickAction' | 'escapeKeyAction' | 'modeless' |
'draggable' | 'transition'
'fullscreen' | 'fullscreenBreakpoint' | 'footerHidden' | 'stacked' | 'defaultAction' |
'actionAttribute' | 'focusAttribute' | 'scrimClickAction' | 'escapeKeyAction' | 'modeless' |
'draggable' | 'transition'
>> {
open?: Stream<boolean>;
onOpen?: () => void;

View File

@ -3,7 +3,6 @@ import '@material/web/button/text-button.js';
import Dialog, {DialogAttributes} from '@osm/Components/Dialogs/Dialog';
import Model from '@osm/Models/Model';
import {Vnode} from 'mithril';
export interface RecordDialogAttributes<M extends Model<any, any>> extends DialogAttributes {

View File

@ -1,6 +1,5 @@
import autoAnimate from '@formkit/auto-animate';
import {ComponentAttributes} from '@maicol07/inertia-mithril';
import Footer from '@osm/Components/layout/Footer';
import {Collection} from 'collect.js';
import {

View File

@ -1,7 +1,6 @@
import '@material/web/button/outlined-button.js';
import {mdiChevronLeft} from '@mdi/js';
import MdIcon from '@osm/Components/MdIcon';
import Page, {PageAttributes} from '@osm/Components/Page';
import Model from '@osm/Models/Model';

View File

@ -1,15 +1,15 @@
/* eslint-disable sonarjs/no-duplicate-string */
import '@maicol07/material-web-additions/layout-grid/layout-grid.js';
import '@material/web/dialog/dialog.js';
import '@material/web/fab/branded-fab.js';
import '@material/web/iconbutton/standard-icon-button.js';
import {router} from '@maicol07/inertia-mithril';
import {
FilterTextFieldInputEventDetail,
SortButtonClickedEventDetail
} from '@maicol07/material-web-additions/data-table/lib/data-table-column.js';
import '@maicol07/material-web-additions/layout-grid/layout-grid.js';
import '@material/web/dialog/dialog.js';
import '@material/web/fab/branded-fab.js';
import '@material/web/iconbutton/standard-icon-button.js';
import {mdiPlus} from '@mdi/js';
import RecordsTable, {RecordsTableColumnAttributes} from '@osm/Components/DataTable/RecordsTable';
import AddEditRecordDialog from '@osm/Components/Dialogs/AddEditRecordDialog';
import DeleteRecordDialog, {DeleteRecordDialogAttributes} from '@osm/Components/Dialogs/DeleteRecordDialog';

View File

@ -4,7 +4,7 @@
/**
* Type that returns an array of all keys of a provided object that are of
* of the provided type, or a subtype of the type.
* the provided type, or a subtype of the type.
*/
declare type KeysOfType<Type extends object, Match> = {
[Key in keyof Type]-?: Type[Key] extends Match ? Key : never;
@ -39,7 +39,7 @@ declare type KeyOfType<Type extends object, Match> = KeysOfType<Type, Match>[key
*
* @param object The object that owns the method
* @param methods The name or names of the method(s) to extend
* @param callback A callback which mutates the method's output
* @param callback A callback, which mutates the method's output.
*/
export function extend<T extends Record<string, any>, K extends KeyOfType<T, Function>>(
object: T,
@ -89,7 +89,7 @@ export function extend<T extends Record<string, any>, K extends KeyOfType<T, Fun
*
* @param object The object that owns the method
* @param methods The name or names of the method(s) to override
* @param newMethod The method to replace it with
* @param newMethod The method to replace it with.
*/
export function override<T extends Record<any, any>, K extends KeyOfType<T, Function>>(
object: T,

View File

@ -1,11 +1,12 @@
import '@material/web/list/list.js';
import '../m3/NavigationDrawer';
import '../m3/NavigationDrawerModal';
import {
mdiAccountGroupOutline,
mdiMenuOpen,
mdiViewDashboardOutline
} from '@mdi/js';
import MdIcon from '@osm/Components/MdIcon';
import {VnodeCollectionItem} from '@osm/typings/jsx';
import {isMobile} from '@osm/utils/misc';
@ -14,13 +15,11 @@ import {
Children,
Vnode
} from 'mithril';
import Stream from 'mithril/stream';
import {
Attributes,
Component
} from 'mithril-utilities';
import Stream from 'mithril/stream';
import '../m3/NavigationDrawer';
import '../m3/NavigationDrawerModal';
import {DrawerEntry} from './DrawerEntry';

View File

@ -1,9 +1,9 @@
import {router} from '@maicol07/inertia-mithril';
import '@material/web/icon/icon.js';
import {ListItemLink} from '@material/web/list/lib/listitemlink/list-item-link';
import '@material/web/list/list-item-link.js';
import type * as MaterialIcons from '@mdi/js';
import {router} from '@maicol07/inertia-mithril';
import {ListItemLink} from '@material/web/list/lib/listitemlink/list-item-link';
import type * as MaterialIcons from '@mdi/js';
import MdIcon from '@osm/Components/MdIcon';
import {Vnode} from 'mithril';
import {

View File

@ -1,10 +1,10 @@
import '@material/web/iconbutton/standard-icon-button.js';
import '@osm/WebComponents/TopAppBar';
import {
mdiMenu,
mdiMenuOpen
} from '@mdi/js';
import logo from '@osm/../images/logo.png';
import Drawer from '@osm/Components/layout/Drawer';
import NotificationsAction from '@osm/Components/layout/topappbar_actions/NotificationsAction';
@ -17,17 +17,16 @@ import {
isMobile,
mobileMediaQuery
} from '@osm/utils/misc';
import '@osm/WebComponents/TopAppBar';
import {collect} from 'collect.js';
import {
Vnode,
VnodeDOM
} from 'mithril';
import Stream from 'mithril/stream';
import {
Attributes,
Component
} from 'mithril-utilities';
import Stream from 'mithril/stream';
export default class TopAppBar extends Component {
drawerOpenState = Stream(!isMobile());

View File

@ -1,5 +1,4 @@
import {mdiBellOutline} from '@mdi/js';
import TopAppBarAction from '@osm/Components/layout/topappbar_actions/TopAppBarAction';
export default class NotificationsAction extends TopAppBarAction {

View File

@ -1,5 +1,4 @@
import {mdiCalendarRangeOutline} from '@mdi/js';
import TopAppBarAction from '@osm/Components/layout/topappbar_actions/TopAppBarAction';
export default class PeriodSwitcherAction extends TopAppBarAction {

View File

@ -1,17 +1,17 @@
import {router} from '@maicol07/inertia-mithril';
import '@material/web/button/outlined-button.js';
import '@material/web/button/text-button.js';
import {router} from '@maicol07/inertia-mithril';
import {
mdiAccountCircleOutline,
mdiAccountOutline,
mdiLogoutVariant
} from '@mdi/js';
import Dialog from '@osm/Components/Dialogs/Dialog';
import MdIcon from '@osm/Components/MdIcon';
import {Vnode} from 'mithril';
import {Request} from 'mithril-utilities';
import Stream from 'mithril/stream';
import {Request} from 'mithril-utilities';
import TopAppBarAction from './TopAppBarAction';

View File

@ -1,5 +1,5 @@
import {styles} from '@material/web/navigationdrawer/lib/navigation-drawer-styles.css.js';
import {NavigationDrawer as MDNavigationDrawer} from '@material/web/navigationdrawer/lib/navigation-drawer.js';
import {styles} from '@material/web/navigationdrawer/lib/navigation-drawer-styles.css.js';
import {styles as sharedStyles} from '@material/web/navigationdrawer/lib/shared-styles.css.js';
import {css} from 'lit';
import {customElement} from 'lit/decorators.js';

View File

@ -1,5 +1,5 @@
import {styles} from '@material/web/navigationdrawer/lib/navigation-drawer-modal-styles.css.js';
import {NavigationDrawerModal as MDNavigationDrawerModal} from '@material/web/navigationdrawer/lib/navigation-drawer-modal.js';
import {styles} from '@material/web/navigationdrawer/lib/navigation-drawer-modal-styles.css.js';
import {styles as sharedStyles} from '@material/web/navigationdrawer/lib/shared-styles.css.js';
import {css} from 'lit';
import {customElement} from 'lit/decorators.js';

View File

@ -3,6 +3,7 @@ import '@material/web/button/filled-button.js';
import '@material/web/button/text-button.js';
import '@material/web/checkbox/checkbox.js';
import '@material/web/dialog/dialog.js';
import '@osm/Components/m3/FilledTextField';
import {Dialog} from '@material/web/dialog/lib/dialog';
import {
@ -12,8 +13,6 @@ import {
mdiLockQuestion,
mdiLoginVariant
} from '@mdi/js';
import '@osm/Components/m3/FilledTextField';
import MdIcon from '@osm/Components/MdIcon';
import Page, {PageAttributes} from '@osm/Components/Page';
import {VnodeCollectionItem} from '@osm/typings/jsx';
@ -23,13 +22,13 @@ import type {
Vnode,
VnodeDOM
} from 'mithril';
import Stream from 'mithril/stream';
import {
Form,
FormSubmitEvent,
Request,
RequestError
} from 'mithril-utilities';
import Stream from 'mithril/stream';
export default class LoginPage extends Page {
form = {

View File

@ -1,26 +1,26 @@
import {router} from '@maicol07/inertia-mithril';
import '@maicol07/material-web-additions/card/elevated-card.js';
import '@material/web/button/filled-button.js';
import '@osm/Components/m3/FilledTextField';
import {router} from '@maicol07/inertia-mithril';
import {
mdiAccountOutline,
mdiLockCheckOutline,
mdiLockOutline
} from '@mdi/js';
import '@osm/Components/m3/FilledTextField';
import MdIcon from '@osm/Components/MdIcon';
import Page, {PageAttributes} from '@osm/Components/Page';
import {VnodeCollectionItem} from '@osm/typings/jsx';
import {showSnackbar} from '@osm/utils/misc';
import collect from 'collect.js';
import type {Vnode} from 'mithril';
import Stream from 'mithril/stream';
import {
Form,
FormSubmitEvent,
Request,
RequestError
} from 'mithril-utilities';
import Stream from 'mithril/stream';
export default class ResetPasswordPage extends Page {
form = {

View File

@ -1,17 +1,17 @@
import {router} from '@maicol07/inertia-mithril';
import '@maicol07/material-web-additions/card/elevated-card.js';
import {router} from '@maicol07/inertia-mithril';
import Page, {PageAttributes} from '@osm/Components/Page';
import {showSnackbar} from '@osm/utils/misc';
import AdminUserStep from '@osm/Views/Setup/Steps/AdminUserStep';
import DatabaseStep from '@osm/Views/Setup/Steps/DatabaseStep';
import RegionalSettings from '@osm/Views/Setup/Steps/RegionalSettings';
import type {Vnode} from 'mithril';
import Stream from 'mithril/stream';
import {
Request,
RequestError
} from 'mithril-utilities';
import Stream from 'mithril/stream';
import {
SetupStep,

View File

@ -1,4 +1,5 @@
import '@material/web/button/filled-button.js';
import '@osm/Components/m3/FilledTextField';
import {
mdiAccountOutline,
@ -7,8 +8,6 @@ import {
mdiLockCheckOutline,
mdiLockOutline
} from '@mdi/js';
import '@osm/Components/m3/FilledTextField';
import MdIcon from '@osm/Components/MdIcon';
import {VnodeCollectionItem} from '@osm/typings/jsx';
import {
@ -18,11 +17,11 @@ import {
} from '@osm/Views/Setup/Steps/SetupStep';
import collect from 'collect.js';
import {Vnode} from 'mithril';
import Stream from 'mithril/stream';
import {
Form,
FormSubmitEvent
} from 'mithril-utilities';
import Stream from 'mithril/stream';
interface AdminUserStepAttributes extends SetupStepAttributes {
onSaveInstall: (event: FormSubmitEvent) => void;

View File

@ -1,4 +1,5 @@
import '@maicol07/material-web-additions/layout-grid/layout-grid.js';
import '@osm/Components/m3/FilledTextField';
import {
mdiAccountOutline,
@ -8,8 +9,6 @@ import {
mdiServerNetwork,
mdiTestTube
} from '@mdi/js';
import '@osm/Components/m3/FilledTextField';
import MdIcon from '@osm/Components/MdIcon';
import {VnodeCollectionItem} from '@osm/typings/jsx';
import {showSnackbar} from '@osm/utils/misc';
@ -18,12 +17,12 @@ import {
Children,
Vnode
} from 'mithril';
import Stream from 'mithril/stream';
import {
Form,
Request,
RequestError
} from 'mithril-utilities';
import Stream from 'mithril/stream';
import {
SetupStep,

View File

@ -3,13 +3,12 @@ import {
mdiCalendarMonthOutline,
mdiClockOutline
} from '@mdi/js';
import MdIcon from '@osm/Components/MdIcon';
import {VnodeCollectionItem} from '@osm/typings/jsx';
import collect from 'collect.js';
import dayjs from 'dayjs';
import {Form} from 'mithril-utilities';
import Stream from 'mithril/stream';
import {Form} from 'mithril-utilities';
import {
SetupStep,

View File

@ -4,7 +4,6 @@ import {
mdiChevronLeft,
mdiChevronRight
} from '@mdi/js';
import MdIcon from '@osm/Components/MdIcon';
import {
Children,

View File

@ -1,9 +1,10 @@
import type {MdCheckbox} from '@material/web/checkbox/checkbox';
import '@material/web/checkbox/checkbox.js';
import '@material/web/field/outlined-field.js';
import '@material/web/select/filled-select.js';
import {Select} from '@material/web/select/lib/select';
import '@material/web/select/select-option.js';
import type {MdCheckbox} from '@material/web/checkbox/checkbox';
import {Select} from '@material/web/select/lib/select';
import {mdiLicense} from '@mdi/js';
import MdIcon from '@osm/Components/MdIcon';
import {
@ -15,11 +16,11 @@ import {
showSnackbar
} from '@osm/utils/misc';
import {Vnode} from 'mithril';
import Stream from 'mithril/stream';
import {
Request,
RequestError
} from 'mithril-utilities';
import Stream from 'mithril/stream';
import {
SetupStep,

View File

@ -1,10 +1,10 @@
import '@osm/Components/m3/FilledTextField';
import {
mdiAccountOutline,
mdiEmailOutline
} from '@mdi/js';
import AddEditRecordDialog from '@osm/Components/Dialogs/AddEditRecordDialog';
import '@osm/Components/m3/FilledTextField';
import MdIcon from '@osm/Components/MdIcon';
import User, {UserAttributes} from '@osm/Models/User';
import {JSONAPI} from '@osm/typings/request';

View File

@ -1,5 +1,6 @@
import {createInertiaApp} from '@maicol07/inertia-mithril';
import '@osm/../scss/app.scss';
import {createInertiaApp} from '@maicol07/inertia-mithril';
import {showSnackbar} from '@osm/utils/misc';
import Mithril from 'mithril';
import {registerSW} from 'virtual:pwa-register';
@ -25,14 +26,14 @@ window.tr = translator;
window._v = vnodeTranslator;
window.__ = stringTranslator;
// Load modules bootstrap
// Load modules bootstrap file
import.meta.glob('../../vendor/**/**/resources/{js,ts}/bootstrap.{tsx,ts,js,jsx}', {eager: true});
await createInertiaApp({
title: ((title) => `${title} - OpenSTAManager`),
// This rule is disabled to avoid a bug in Inertia plugin
// eslint-disable-next-line arrow-body-style
resolve: resolvePage((page) => {
resolve: resolvePage(() => {
return import.meta.glob<OpenSTAManager.ImportedModule>('./Views/**/*.tsx');
}),
setup({el, App, props}) {
@ -41,7 +42,7 @@ await createInertiaApp({
}
m.mount(el, {
view: (vnode) => m(App, props)
view: () => m(App, props)
});
}
});

View File

@ -1,10 +1,10 @@
/* eslint-disable @typescript-eslint/naming-convention */
// noinspection JSFileReferences,JSUnusedGlobalSymbols,LocalVariableNamingConventionJS
import 'inertia-plugin/client';
import type Mithril from 'mithril';
import 'vite-plugin-pwa/client.d';
import 'vite/client';
import type Mithril from 'mithril';
import type router from 'ziggy-js';
import type {
@ -25,6 +25,7 @@ declare global {
REVISION: string,
};
// noinspection LocalVariableNamingConventionJS
const LARAVEL_TRANSLATIONS: Record<string, Record<string, string>>;
interface Window {
@ -36,6 +37,8 @@ declare global {
const m: typeof Mithril;
const tr: typeof translator;
// noinspection LocalVariableNamingConventionJS
const _v: typeof vnodeTranslator;
// noinspection LocalVariableNamingConventionJS
const __: typeof stringTranslator;
}

View File

@ -1,7 +1,8 @@
import 'mithril-utilities/typings';
import {LayoutGridAttributes} from '@maicol07/material-web-additions/layout-grid/lib/layout-grid';
import {Collection} from 'collect.js';
import Mithril from 'mithril';
import 'mithril-utilities/typings';
export type VnodeCollectionItem = Record<string, Mithril.Vnode>;
export type VnodeCollection = Collection<VnodeCollectionItem>;

View File

@ -3,7 +3,6 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
{{-- <meta name="csrf-token" content="{{csrf_token()}}">--}}
<title>@lang('OpenSTAManager')</title>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
@ -41,16 +40,6 @@
'time_format' => settings('time_format'),
]
]);
{{--{--}}
{{-- events: {},--}}
{{-- locale: '{{app()->getLocale()}}',--}}
{{-- modules: @js($modules->pluck('modules')->collapse()->all()),--}}
{{-- theme: @js(session('high-contrast') ? 'high-contrast' : 'light'),--}}
{{-- translations: @js(cache()->rememberForever('translations', static fn () => Controller::getTranslations()->toArray())),--}}
{{-- user: @js(auth()->user()),--}}
{{-- VERSION: @js(trim(file_get_contents(base_path('VERSION')))),--}}
{{-- REVISION: @js(trim(file_get_contents(base_path('REVISION'))))--}}
{{--};--}}
</script>
@routes

View File

@ -1,7 +1,5 @@
<?php
/** @noinspection UnusedFunctionResultInspection */
use App\Http\Controllers\Api\SetupController;
use App\Http\Middleware\CheckConfigurationMiddleware;
@ -11,7 +9,7 @@ use App\Http\Middleware\CheckConfigurationMiddleware;
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| routes are loaded by the RouteServiceProvider within a group, which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

View File

@ -1,5 +1,6 @@
<?php
use App\Models\User;
use Illuminate\Support\Facades\Broadcast;
/*
@ -7,12 +8,11 @@ use Illuminate\Support\Facades\Broadcast;
| Broadcast Channels
|--------------------------------------------------------------------------
|
| Here you may register all of the event broadcasting channels that your
| Here you may register all the event broadcasting channels that your
| application supports. The given channel authorization callbacks are
| used to check if an authenticated user can listen to the channel.
|
*/
Broadcast::channel('App.Models.User.{id}', function ($user, $id) {
return (int) $user->id === (int) $id;
Broadcast::channel('App.Models.User.{id}', static function (User $user, string|int $id) {
return $user->id === (int) $id;
});

View File

@ -8,12 +8,14 @@ use Illuminate\Support\Facades\Artisan;
| Console Routes
|--------------------------------------------------------------------------
|
| This file is where you may define all of your Closure based console
| This file is where you may define all of your Closure-based console
| commands. Each Closure is bound to a command instance allowing a
| simple approach to interacting with each command's IO methods.
|
*/
Artisan::command('inspire', function () {
/**
* @psalm-suppress InvalidScope
*/
$this->comment(Inspiring::quote());
})->purpose('Display an inspiring quote');

View File

@ -1,7 +1,5 @@
<?php
/** @noinspection UnusedFunctionResultInspection */
use App\Http\Controllers\Controller;
use App\Http\Middleware\CheckConfigurationMiddleware;
use Illuminate\Support\Facades\Route;
@ -30,11 +28,8 @@ Route::middleware('guest')->group(static function () {
->name('password.reset');
Route::inertia('setup', 'Setup/SetupPage', [
'languages' => cache()->rememberForever('app.languages', fn () => array_map(
static fn ($file) => basename($file, '.json'),
glob(lang_path('/*.json'), GLOB_NOSORT)
)),
'license' => cache()->rememberForever('app.license', fn () => file_get_contents(base_path('LICENSE'))),
'languages' => app(Controller::class)->getLanguages(),
'license' => cache()->rememberForever('app.license', static fn () => file_get_contents(base_path('LICENSE'))),
'external' => true,
])
->middleware('guest', CheckConfigurationMiddleware::class)
@ -57,7 +52,7 @@ Route::middleware('auth')->group(static function () {
->name('users.show');
});
Route::get('refresh_csrf', static fn () => function () {
Route::get('refresh_csrf', static fn () => static function () {
session()->regenerate();
return response()->json(['token' => csrf_token()]);