chore: format and refactor the Connected Service component to use dto collection
This commit is contained in:
parent
ca628fb009
commit
9443ac181c
@ -4,8 +4,7 @@
|
|||||||
|
|
||||||
namespace App\Actions\Fortify;
|
namespace App\Actions\Fortify;
|
||||||
|
|
||||||
use App\Concerns\PasswordValidationRules;
|
use App\Concerns\{PasswordValidationRules, ProfileValidationRules};
|
||||||
use App\Concerns\ProfileValidationRules;
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Support\Facades\Validator;
|
use Illuminate\Support\Facades\Validator;
|
||||||
use Laravel\Fortify\Contracts\CreatesNewUsers;
|
use Laravel\Fortify\Contracts\CreatesNewUsers;
|
||||||
|
|||||||
@ -1,14 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Data\Ui\ConnectedServices;
|
|
||||||
|
|
||||||
use Illuminate\Support\Collection;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A collection of connected services.
|
|
||||||
*
|
|
||||||
* @extends Collection<int, ConnectedServiceData>
|
|
||||||
*/
|
|
||||||
final class ConnectedServiceCollectionData extends Collection {}
|
|
||||||
@ -4,16 +4,11 @@
|
|||||||
|
|
||||||
namespace App\Data\Ui\ConnectedServices;
|
namespace App\Data\Ui\ConnectedServices;
|
||||||
|
|
||||||
use App\Enums\ConnectionStatus;
|
use App\Enums\{ConnectionStatus, ConnectionTechTypes};
|
||||||
use App\Enums\ConnectionTechTypes;
|
|
||||||
use Livewire\Wireable;
|
|
||||||
use Spatie\LaravelData\Concerns\WireableData;
|
|
||||||
use Spatie\LaravelData\Data;
|
use Spatie\LaravelData\Data;
|
||||||
|
|
||||||
final class ConnectedServiceData extends Data implements Wireable
|
final class ConnectedServiceData extends Data
|
||||||
{
|
{
|
||||||
use WireableData;
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public string $name,
|
public string $name,
|
||||||
public string $icon,
|
public string $icon,
|
||||||
|
|||||||
@ -1,18 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
namespace App\Data\Ui\ConnectedServices;
|
|
||||||
|
|
||||||
use Livewire\Wireable;
|
|
||||||
use Spatie\LaravelData\Concerns\WireableData;
|
|
||||||
use Spatie\LaravelData\Data;
|
|
||||||
|
|
||||||
final class ConnectedServicesData extends Data implements Wireable
|
|
||||||
{
|
|
||||||
use WireableData;
|
|
||||||
|
|
||||||
public function __construct(
|
|
||||||
public ConnectedServiceCollectionData $services,
|
|
||||||
) {}
|
|
||||||
}
|
|
||||||
@ -7,8 +7,7 @@
|
|||||||
use App\Data\Users\UserData;
|
use App\Data\Users\UserData;
|
||||||
use App\Enums\RolesStatus;
|
use App\Enums\RolesStatus;
|
||||||
use Spatie\LaravelData\Attributes\DataCollectionOf;
|
use Spatie\LaravelData\Attributes\DataCollectionOf;
|
||||||
use Spatie\LaravelData\Data;
|
use Spatie\LaravelData\{Data, DataCollection};
|
||||||
use Spatie\LaravelData\DataCollection;
|
|
||||||
|
|
||||||
final class RoleData extends Data
|
final class RoleData extends Data
|
||||||
{
|
{
|
||||||
|
|||||||
@ -4,8 +4,7 @@
|
|||||||
|
|
||||||
namespace App\Livewire\Actions;
|
namespace App\Livewire\Actions;
|
||||||
|
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\{Auth, Session};
|
||||||
use Illuminate\Support\Facades\Session;
|
|
||||||
|
|
||||||
final class Logout
|
final class Logout
|
||||||
{
|
{
|
||||||
|
|||||||
@ -8,8 +8,7 @@
|
|||||||
use Flux\Flux;
|
use Flux\Flux;
|
||||||
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Livewire\Attributes\Computed;
|
use Livewire\Attributes\{Computed, Title};
|
||||||
use Livewire\Attributes\Title;
|
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
#[Title('Profile settings')]
|
#[Title('Profile settings')]
|
||||||
|
|||||||
@ -9,15 +9,9 @@
|
|||||||
use Flux\Flux;
|
use Flux\Flux;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Validation\ValidationException;
|
use Illuminate\Validation\ValidationException;
|
||||||
use Laravel\Fortify\Actions\ConfirmTwoFactorAuthentication;
|
use Laravel\Fortify\Actions\{ConfirmTwoFactorAuthentication, DisableTwoFactorAuthentication, EnableTwoFactorAuthentication};
|
||||||
use Laravel\Fortify\Actions\DisableTwoFactorAuthentication;
|
use Laravel\Fortify\{Features, Fortify};
|
||||||
use Laravel\Fortify\Actions\EnableTwoFactorAuthentication;
|
use Livewire\Attributes\{Computed, Locked, Title, Validate};
|
||||||
use Laravel\Fortify\Features;
|
|
||||||
use Laravel\Fortify\Fortify;
|
|
||||||
use Livewire\Attributes\Computed;
|
|
||||||
use Livewire\Attributes\Locked;
|
|
||||||
use Livewire\Attributes\Title;
|
|
||||||
use Livewire\Attributes\Validate;
|
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
|
||||||
#[Title('Security settings')]
|
#[Title('Security settings')]
|
||||||
|
|||||||
@ -6,8 +6,7 @@
|
|||||||
|
|
||||||
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
// use Illuminate\Contracts\Auth\MustVerifyEmail;
|
||||||
use Database\Factories\UserFactory;
|
use Database\Factories\UserFactory;
|
||||||
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
use Illuminate\Database\Eloquent\Attributes\{Fillable, Hidden};
|
||||||
use Illuminate\Database\Eloquent\Attributes\Hidden;
|
|
||||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Foundation\Auth\User as Authenticatable;
|
use Illuminate\Foundation\Auth\User as Authenticatable;
|
||||||
use Illuminate\Notifications\Notifiable;
|
use Illuminate\Notifications\Notifiable;
|
||||||
@ -20,6 +19,7 @@ final class User extends Authenticatable
|
|||||||
{
|
{
|
||||||
/** @use HasFactory<UserFactory> */
|
/** @use HasFactory<UserFactory> */
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
use Notifiable;
|
use Notifiable;
|
||||||
use TwoFactorAuthenticatable;
|
use TwoFactorAuthenticatable;
|
||||||
|
|
||||||
|
|||||||
@ -5,8 +5,7 @@
|
|||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use Carbon\CarbonImmutable;
|
use Carbon\CarbonImmutable;
|
||||||
use Illuminate\Support\Facades\Date;
|
use Illuminate\Support\Facades\{DB, Date};
|
||||||
use Illuminate\Support\Facades\DB;
|
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Illuminate\Validation\Rules\Password;
|
use Illuminate\Validation\Rules\Password;
|
||||||
|
|
||||||
|
|||||||
@ -4,13 +4,11 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use App\Actions\Fortify\CreateNewUser;
|
use App\Actions\Fortify\{CreateNewUser, ResetUserPassword};
|
||||||
use App\Actions\Fortify\ResetUserPassword;
|
|
||||||
use Illuminate\Cache\RateLimiting\Limit;
|
use Illuminate\Cache\RateLimiting\Limit;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use Illuminate\Support\Facades\RateLimiter;
|
use Illuminate\Support\Facades\RateLimiter;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\{ServiceProvider, Str};
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use Laravel\Fortify\Fortify;
|
use Laravel\Fortify\Fortify;
|
||||||
|
|
||||||
final class FortifyServiceProvider extends ServiceProvider
|
final class FortifyServiceProvider extends ServiceProvider
|
||||||
|
|||||||
@ -4,9 +4,8 @@
|
|||||||
|
|
||||||
namespace App\Providers;
|
namespace App\Providers;
|
||||||
|
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\{Arr, ServiceProvider};
|
||||||
use Illuminate\Support\Facades\Blade;
|
use Illuminate\Support\Facades\Blade;
|
||||||
use Illuminate\Support\ServiceProvider;
|
|
||||||
|
|
||||||
final class ScopeServiceProvider extends ServiceProvider
|
final class ScopeServiceProvider extends ServiceProvider
|
||||||
{
|
{
|
||||||
@ -26,10 +25,10 @@ public function registerScopeDirective(): void
|
|||||||
*
|
*
|
||||||
* https://github.com/konradkalemba/blade-components-scoped-slots
|
* https://github.com/konradkalemba/blade-components-scoped-slots
|
||||||
*/
|
*/
|
||||||
Blade::directive("scope", function ($expression) {
|
Blade::directive('scope', function ($expression) {
|
||||||
// Split the expression by `top-level` commas (not in parentheses)
|
// Split the expression by `top-level` commas (not in parentheses)
|
||||||
$directiveArguments = preg_split("/,(?![^\(\(]*[\)\)])/", $expression);
|
$directiveArguments = preg_split("/,(?![^\(\(]*[\)\)])/", $expression);
|
||||||
$directiveArguments = array_map("trim", $directiveArguments);
|
$directiveArguments = array_map('trim', $directiveArguments);
|
||||||
|
|
||||||
// PHP 8.5 Safe Unpacking (Prevents "Undefined array key" crashes)
|
// PHP 8.5 Safe Unpacking (Prevents "Undefined array key" crashes)
|
||||||
$name = $directiveArguments[0] ?? "''";
|
$name = $directiveArguments[0] ?? "''";
|
||||||
@ -40,7 +39,7 @@ public function registerScopeDirective(): void
|
|||||||
$uses = array_flip($uses);
|
$uses = array_flip($uses);
|
||||||
$uses[] = '$__env';
|
$uses[] = '$__env';
|
||||||
$uses[] = '$__bladeCompiler';
|
$uses[] = '$__bladeCompiler';
|
||||||
$uses = implode(",", $uses);
|
$uses = implode(',', $uses);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Slot names can`t contains dot , eg: `user.city`.
|
* Slot names can`t contains dot , eg: `user.city`.
|
||||||
@ -48,12 +47,12 @@ public function registerScopeDirective(): void
|
|||||||
*
|
*
|
||||||
* Later, on component it will be replaced back.
|
* Later, on component it will be replaced back.
|
||||||
*/
|
*/
|
||||||
$name = str_replace(".", "___", $name);
|
$name = str_replace('.', '___', $name);
|
||||||
|
|
||||||
// PHP 8.5 Safe Loop Check
|
// PHP 8.5 Safe Loop Check
|
||||||
return "<?php \$__bladeCompiler = \$__bladeCompiler ?? null; \$__env->slot({$name}, function({$functionArguments}) use ({$uses}) { \$loop = !empty(\$__env->getLoopStack()) ? (object) \$__env->getLoopStack()[0] : null; ?>";
|
return "<?php \$__bladeCompiler = \$__bladeCompiler ?? null; \$__env->slot({$name}, function({$functionArguments}) use ({$uses}) { \$loop = !empty(\$__env->getLoopStack()) ? (object) \$__env->getLoopStack()[0] : null; ?>";
|
||||||
});
|
});
|
||||||
|
|
||||||
Blade::directive("endscope", fn() => "<?php }); ?>");
|
Blade::directive('endscope', fn () => '<?php }); ?>');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -6,9 +6,7 @@
|
|||||||
|
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Contracts\View\View;
|
use Illuminate\Contracts\View\View;
|
||||||
use Illuminate\Support\Arr;
|
use Illuminate\Support\{Arr, Carbon, Str};
|
||||||
use Illuminate\Support\Carbon;
|
|
||||||
use Illuminate\Support\Str;
|
|
||||||
use Illuminate\View\Component;
|
use Illuminate\View\Component;
|
||||||
|
|
||||||
final class Table extends Component
|
final class Table extends Component
|
||||||
@ -44,10 +42,8 @@ public function __construct(
|
|||||||
// Remove closures from serialization
|
// Remove closures from serialization
|
||||||
unset($this->rowDecoration, $this->cellDecoration, $this->headers);
|
unset($this->rowDecoration, $this->cellDecoration, $this->headers);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Serialize a unique ID for component tracking
|
// Serialize a unique ID for component tracking
|
||||||
$this->uuid = "table-" . md5(serialize($this)) . $id;
|
$this->uuid = 'table-'.md5(serialize($this)).$id;
|
||||||
|
|
||||||
// Restore closures
|
// Restore closures
|
||||||
$this->rowDecoration = $rowDecoration;
|
$this->rowDecoration = $rowDecoration;
|
||||||
@ -104,7 +100,7 @@ public function redirectLink(mixed $row): string
|
|||||||
|
|
||||||
// Replace tokens with actual row values
|
// Replace tokens with actual row values
|
||||||
$tokens->each(function (string $token) use ($row, &$link): void {
|
$tokens->each(function (string $token) use ($row, &$link): void {
|
||||||
$link = Str::of($link)->replace("{" . $token . "}", data_get($row, $token))->toString();
|
$link = Str::of($link)->replace('{'.$token.'}', data_get($row, $token))->toString();
|
||||||
});
|
});
|
||||||
|
|
||||||
return $link;
|
return $link;
|
||||||
|
|||||||
@ -3,8 +3,7 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Foundation\Application;
|
use Illuminate\Foundation\Application;
|
||||||
use Illuminate\Foundation\Configuration\Exceptions;
|
use Illuminate\Foundation\Configuration\{Exceptions, Middleware};
|
||||||
use Illuminate\Foundation\Configuration\Middleware;
|
|
||||||
|
|
||||||
return Application::configure(basePath: dirname(__DIR__))
|
return Application::configure(basePath: dirname(__DIR__))
|
||||||
->withRouting(
|
->withRouting(
|
||||||
|
|||||||
@ -3,22 +3,11 @@
|
|||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Illuminate\Contracts\Support\Arrayable;
|
use Illuminate\Contracts\Support\Arrayable;
|
||||||
use Spatie\LaravelData\Casts\DateTimeInterfaceCast;
|
use Spatie\LaravelData\Casts\{DateTimeInterfaceCast, EnumCast};
|
||||||
use Spatie\LaravelData\Casts\EnumCast;
|
use Spatie\LaravelData\Normalizers\{ArrayNormalizer, ArrayableNormalizer, JsonNormalizer, ModelNormalizer, ObjectNormalizer};
|
||||||
use Spatie\LaravelData\Normalizers\ArrayableNormalizer;
|
use Spatie\LaravelData\RuleInferrers\{AttributesRuleInferrer, BuiltInTypesRuleInferrer, NullableRuleInferrer, RequiredRuleInferrer, SometimesRuleInferrer};
|
||||||
use Spatie\LaravelData\Normalizers\ArrayNormalizer;
|
|
||||||
use Spatie\LaravelData\Normalizers\JsonNormalizer;
|
|
||||||
use Spatie\LaravelData\Normalizers\ModelNormalizer;
|
|
||||||
use Spatie\LaravelData\Normalizers\ObjectNormalizer;
|
|
||||||
use Spatie\LaravelData\RuleInferrers\AttributesRuleInferrer;
|
|
||||||
use Spatie\LaravelData\RuleInferrers\BuiltInTypesRuleInferrer;
|
|
||||||
use Spatie\LaravelData\RuleInferrers\NullableRuleInferrer;
|
|
||||||
use Spatie\LaravelData\RuleInferrers\RequiredRuleInferrer;
|
|
||||||
use Spatie\LaravelData\RuleInferrers\SometimesRuleInferrer;
|
|
||||||
use Spatie\LaravelData\Support\Creation\ValidationStrategy;
|
use Spatie\LaravelData\Support\Creation\ValidationStrategy;
|
||||||
use Spatie\LaravelData\Transformers\ArrayableTransformer;
|
use Spatie\LaravelData\Transformers\{ArrayableTransformer, DateTimeInterfaceTransformer, EnumTransformer};
|
||||||
use Spatie\LaravelData\Transformers\DateTimeInterfaceTransformer;
|
|
||||||
use Spatie\LaravelData\Transformers\EnumTransformer;
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
/*
|
/*
|
||||||
@ -26,36 +15,36 @@
|
|||||||
* is an array, it will try to convert from the first format that works,
|
* is an array, it will try to convert from the first format that works,
|
||||||
* and will serialize dates using the first format from the array.
|
* and will serialize dates using the first format from the array.
|
||||||
*/
|
*/
|
||||||
"date_format" => DATE_ATOM,
|
'date_format' => DATE_ATOM,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When transforming or casting dates, the following timezone will be used to
|
* When transforming or casting dates, the following timezone will be used to
|
||||||
* convert the date to the correct timezone. If set to null no timezone will
|
* convert the date to the correct timezone. If set to null no timezone will
|
||||||
* be passed.
|
* be passed.
|
||||||
*/
|
*/
|
||||||
"date_timezone" => null,
|
'date_timezone' => null,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It is possible to enable certain features of the package, these would otherwise
|
* It is possible to enable certain features of the package, these would otherwise
|
||||||
* be breaking changes, and thus they are disabled by default. In the next major
|
* be breaking changes, and thus they are disabled by default. In the next major
|
||||||
* version of the package, these features will be enabled by default.
|
* version of the package, these features will be enabled by default.
|
||||||
*/
|
*/
|
||||||
"features" => [
|
'features' => [
|
||||||
"cast_and_transform_iterables" => false,
|
'cast_and_transform_iterables' => false,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When trying to set a computed property value, the package will throw an exception.
|
* When trying to set a computed property value, the package will throw an exception.
|
||||||
* You can disable this behaviour by setting this option to true, which will then just
|
* You can disable this behaviour by setting this option to true, which will then just
|
||||||
* ignore the value being passed into the computed property and recalculate it.
|
* ignore the value being passed into the computed property and recalculate it.
|
||||||
*/
|
*/
|
||||||
"ignore_exception_when_trying_to_set_computed_property_value" => false,
|
'ignore_exception_when_trying_to_set_computed_property_value' => false,
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Global transformers will take complex types and transform them into simple
|
* Global transformers will take complex types and transform them into simple
|
||||||
* types.
|
* types.
|
||||||
*/
|
*/
|
||||||
"transformers" => [
|
'transformers' => [
|
||||||
DateTimeInterface::class => DateTimeInterfaceTransformer::class,
|
DateTimeInterface::class => DateTimeInterfaceTransformer::class,
|
||||||
Arrayable::class => ArrayableTransformer::class,
|
Arrayable::class => ArrayableTransformer::class,
|
||||||
BackedEnum::class => EnumTransformer::class,
|
BackedEnum::class => EnumTransformer::class,
|
||||||
@ -65,7 +54,7 @@
|
|||||||
* Global casts will cast values into complex types when creating a data
|
* Global casts will cast values into complex types when creating a data
|
||||||
* object from simple types.
|
* object from simple types.
|
||||||
*/
|
*/
|
||||||
"casts" => [
|
'casts' => [
|
||||||
DateTimeInterface::class => DateTimeInterfaceCast::class,
|
DateTimeInterface::class => DateTimeInterfaceCast::class,
|
||||||
BackedEnum::class => EnumCast::class,
|
BackedEnum::class => EnumCast::class,
|
||||||
// Enumerable::class => Spatie\LaravelData\Casts\EnumerableCast::class,
|
// Enumerable::class => Spatie\LaravelData\Casts\EnumerableCast::class,
|
||||||
@ -76,7 +65,7 @@
|
|||||||
* validation rules to properties of a data object based upon
|
* validation rules to properties of a data object based upon
|
||||||
* the type of the property.
|
* the type of the property.
|
||||||
*/
|
*/
|
||||||
"rule_inferrers" => [
|
'rule_inferrers' => [
|
||||||
SometimesRuleInferrer::class,
|
SometimesRuleInferrer::class,
|
||||||
NullableRuleInferrer::class,
|
NullableRuleInferrer::class,
|
||||||
RequiredRuleInferrer::class,
|
RequiredRuleInferrer::class,
|
||||||
@ -89,7 +78,7 @@
|
|||||||
* it cannot normalize the payload. The normalizers below are used for
|
* it cannot normalize the payload. The normalizers below are used for
|
||||||
* every data object, unless overridden in a specific data object class.
|
* every data object, unless overridden in a specific data object class.
|
||||||
*/
|
*/
|
||||||
"normalizers" => [
|
'normalizers' => [
|
||||||
ModelNormalizer::class,
|
ModelNormalizer::class,
|
||||||
// Spatie\LaravelData\Normalizers\FormRequestNormalizer::class,
|
// Spatie\LaravelData\Normalizers\FormRequestNormalizer::class,
|
||||||
ArrayableNormalizer::class,
|
ArrayableNormalizer::class,
|
||||||
@ -103,7 +92,7 @@
|
|||||||
* this key can be set globally here for all data objects. You can pass in
|
* this key can be set globally here for all data objects. You can pass in
|
||||||
* `null` if you want to disable wrapping.
|
* `null` if you want to disable wrapping.
|
||||||
*/
|
*/
|
||||||
"wrap" => null,
|
'wrap' => null,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Adds a specific caster to the Symphony VarDumper component which hides
|
* Adds a specific caster to the Symphony VarDumper component which hides
|
||||||
@ -111,7 +100,7 @@
|
|||||||
* by `dump` or `dd`. Can be 'enabled', 'disabled' or 'development'
|
* by `dump` or `dd`. Can be 'enabled', 'disabled' or 'development'
|
||||||
* which will only enable the caster locally.
|
* which will only enable the caster locally.
|
||||||
*/
|
*/
|
||||||
"var_dumper_caster_mode" => "development",
|
'var_dumper_caster_mode' => 'development',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* It is possible to skip the PHP reflection analysis of data objects
|
* It is possible to skip the PHP reflection analysis of data objects
|
||||||
@ -124,18 +113,18 @@
|
|||||||
* in seconds if you want the cache to clear after a certain
|
* in seconds if you want the cache to clear after a certain
|
||||||
* timeframe.
|
* timeframe.
|
||||||
*/
|
*/
|
||||||
"structure_caching" => [
|
'structure_caching' => [
|
||||||
"enabled" => true,
|
'enabled' => true,
|
||||||
"directories" => [app_path("Data")],
|
'directories' => [app_path('Data')],
|
||||||
"cache" => [
|
'cache' => [
|
||||||
"store" => env("CACHE_STORE", env("CACHE_DRIVER", "file")),
|
'store' => env('CACHE_STORE', env('CACHE_DRIVER', 'file')),
|
||||||
"prefix" => "laravel-data",
|
'prefix' => 'laravel-data',
|
||||||
"duration" => null,
|
'duration' => null,
|
||||||
],
|
],
|
||||||
"reflection_discovery" => [
|
'reflection_discovery' => [
|
||||||
"enabled" => true,
|
'enabled' => true,
|
||||||
"base_path" => base_path(),
|
'base_path' => base_path(),
|
||||||
"root_namespace" => null,
|
'root_namespace' => null,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -144,23 +133,23 @@
|
|||||||
* method. By default, only when a request is passed the data is being validated. This
|
* method. By default, only when a request is passed the data is being validated. This
|
||||||
* behaviour can be changed to always validate or to completely disable validation.
|
* behaviour can be changed to always validate or to completely disable validation.
|
||||||
*/
|
*/
|
||||||
"validation_strategy" => ValidationStrategy::OnlyRequests->value,
|
'validation_strategy' => ValidationStrategy::OnlyRequests->value,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A data object can map the names of its properties when transforming (output) or when
|
* A data object can map the names of its properties when transforming (output) or when
|
||||||
* creating (input). By default, the package will not map any names. You can set a
|
* creating (input). By default, the package will not map any names. You can set a
|
||||||
* global strategy here, or override it on a specific data object.
|
* global strategy here, or override it on a specific data object.
|
||||||
*/
|
*/
|
||||||
"name_mapping_strategy" => [
|
'name_mapping_strategy' => [
|
||||||
"input" => null,
|
'input' => null,
|
||||||
"output" => null,
|
'output' => null,
|
||||||
],
|
],
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When using an invalid include, exclude, only or except partial, the package will
|
* When using an invalid include, exclude, only or except partial, the package will
|
||||||
* throw an exception. You can disable this behaviour by setting this option to true.
|
* throw an exception. You can disable this behaviour by setting this option to true.
|
||||||
*/
|
*/
|
||||||
"ignore_invalid_partials" => false,
|
'ignore_invalid_partials' => false,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When transforming a nested chain of data objects, the package can end up in an infinite
|
* When transforming a nested chain of data objects, the package can end up in an infinite
|
||||||
@ -168,39 +157,39 @@
|
|||||||
* set as a safety measure to prevent this from happening. When set to null, the
|
* set as a safety measure to prevent this from happening. When set to null, the
|
||||||
* package will not enforce a maximum depth.
|
* package will not enforce a maximum depth.
|
||||||
*/
|
*/
|
||||||
"max_transformation_depth" => null,
|
'max_transformation_depth' => null,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When the maximum transformation depth is reached, the package will throw an exception.
|
* When the maximum transformation depth is reached, the package will throw an exception.
|
||||||
* You can disable this behaviour by setting this option to true which will return an
|
* You can disable this behaviour by setting this option to true which will return an
|
||||||
* empty array.
|
* empty array.
|
||||||
*/
|
*/
|
||||||
"throw_when_max_transformation_depth_reached" => true,
|
'throw_when_max_transformation_depth_reached' => true,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When using the `make:data` command, the package will use these settings to generate
|
* When using the `make:data` command, the package will use these settings to generate
|
||||||
* the data classes. You can override these settings by passing options to the command.
|
* the data classes. You can override these settings by passing options to the command.
|
||||||
*/
|
*/
|
||||||
"commands" => [
|
'commands' => [
|
||||||
/*
|
/*
|
||||||
* Provides default configuration for the `make:data` command. These settings can be overridden with options
|
* Provides default configuration for the `make:data` command. These settings can be overridden with options
|
||||||
* passed directly to the `make:data` command for generating single Data classes, or if not set they will
|
* passed directly to the `make:data` command for generating single Data classes, or if not set they will
|
||||||
* automatically fall back to these defaults. See `php artisan make:data --help` for more information
|
* automatically fall back to these defaults. See `php artisan make:data --help` for more information
|
||||||
*/
|
*/
|
||||||
"make" => [
|
'make' => [
|
||||||
/*
|
/*
|
||||||
* The default namespace for generated Data classes. This exists under the application's root namespace,
|
* The default namespace for generated Data classes. This exists under the application's root namespace,
|
||||||
* so the default 'Data` will end up as '\App\Data', and generated Data classes will be placed in the
|
* so the default 'Data` will end up as '\App\Data', and generated Data classes will be placed in the
|
||||||
* app/Data/ folder. Data classes can live anywhere, but this is where `make:data` will put them.
|
* app/Data/ folder. Data classes can live anywhere, but this is where `make:data` will put them.
|
||||||
*/
|
*/
|
||||||
"namespace" => "Data",
|
'namespace' => 'Data',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This suffix will be appended to all data classes generated by make:data, so that they are less likely
|
* This suffix will be appended to all data classes generated by make:data, so that they are less likely
|
||||||
* to conflict with other related classes, controllers or models with a similar name without resorting
|
* to conflict with other related classes, controllers or models with a similar name without resorting
|
||||||
* to adding an alias for the Data object. Set to a blank string (not null) to disable.
|
* to adding an alias for the Data object. Set to a blank string (not null) to disable.
|
||||||
*/
|
*/
|
||||||
"suffix" => "Data",
|
'suffix' => 'Data',
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -209,7 +198,7 @@
|
|||||||
* these synths will automatically handle the data objects and their
|
* these synths will automatically handle the data objects and their
|
||||||
* properties when used in a Livewire component.
|
* properties when used in a Livewire component.
|
||||||
*/
|
*/
|
||||||
"livewire" => [
|
'livewire' => [
|
||||||
"enable_synths" => true,
|
'enable_synths' => true,
|
||||||
],
|
],
|
||||||
];
|
];
|
||||||
|
|||||||
@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use Monolog\Handler\NullHandler;
|
use Monolog\Handler\{NullHandler, StreamHandler, SyslogUdpHandler};
|
||||||
use Monolog\Handler\StreamHandler;
|
|
||||||
use Monolog\Handler\SyslogUdpHandler;
|
|
||||||
use Monolog\Processor\PsrLogMessageProcessor;
|
use Monolog\Processor\PsrLogMessageProcessor;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|||||||
@ -30,7 +30,7 @@ public function definition(): array
|
|||||||
'name' => fake()->name(),
|
'name' => fake()->name(),
|
||||||
'email' => fake()->unique()->safeEmail(),
|
'email' => fake()->unique()->safeEmail(),
|
||||||
'email_verified_at' => now(),
|
'email_verified_at' => now(),
|
||||||
'password' => static::$password ??= Hash::make('password'),
|
'password' => self::$password ??= Hash::make('password'),
|
||||||
'remember_token' => Str::random(10),
|
'remember_token' => Str::random(10),
|
||||||
'two_factor_secret' => null,
|
'two_factor_secret' => null,
|
||||||
'two_factor_recovery_codes' => null,
|
'two_factor_recovery_codes' => null,
|
||||||
|
|||||||
@ -6,7 +6,8 @@
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class () extends Migration {
|
return new class() extends Migration
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -6,7 +6,8 @@
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class () extends Migration {
|
return new class() extends Migration
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -6,7 +6,8 @@
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class () extends Migration {
|
return new class() extends Migration
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -6,7 +6,8 @@
|
|||||||
use Illuminate\Database\Schema\Blueprint;
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
use Illuminate\Support\Facades\Schema;
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
return new class () extends Migration {
|
return new class() extends Migration
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* Run the migrations.
|
* Run the migrations.
|
||||||
*/
|
*/
|
||||||
|
|||||||
70
pint.json
70
pint.json
@ -1,21 +1,11 @@
|
|||||||
{
|
{
|
||||||
"preset": "per",
|
"preset": "laravel",
|
||||||
"rules": {
|
"rules": {
|
||||||
"align_multiline_comment": true,
|
|
||||||
"array_indentation": true,
|
|
||||||
"array_syntax": true,
|
|
||||||
"blank_line_after_namespace": true,
|
|
||||||
"blank_line_after_opening_tag": true,
|
|
||||||
"combine_consecutive_issets": true,
|
|
||||||
"combine_consecutive_unsets": true,
|
|
||||||
"concat_space": {
|
|
||||||
"spacing": "one"
|
|
||||||
},
|
|
||||||
"declare_parentheses": true,
|
|
||||||
"declare_strict_types": true,
|
"declare_strict_types": true,
|
||||||
"explicit_string_variable": true,
|
|
||||||
"final_class": true,
|
"final_class": true,
|
||||||
"fully_qualified_strict_types": true,
|
"fully_qualified_strict_types": true,
|
||||||
|
"group_import": true,
|
||||||
|
"single_import_per_statement": false,
|
||||||
"global_namespace_import": {
|
"global_namespace_import": {
|
||||||
"import_classes": true,
|
"import_classes": true,
|
||||||
"import_constants": true,
|
"import_constants": true,
|
||||||
@ -23,14 +13,8 @@
|
|||||||
},
|
},
|
||||||
"is_null": true,
|
"is_null": true,
|
||||||
"lambda_not_used_import": true,
|
"lambda_not_used_import": true,
|
||||||
"logical_operators": true,
|
|
||||||
"mb_str_functions": true,
|
|
||||||
"method_chaining_indentation": true,
|
|
||||||
"modernize_strpos": true,
|
|
||||||
"new_with_braces": true,
|
"new_with_braces": true,
|
||||||
"no_empty_comment": true,
|
"no_empty_comment": true,
|
||||||
"not_operator_with_space": true,
|
|
||||||
"ordered_traits": true,
|
|
||||||
"protected_to_private": true,
|
"protected_to_private": true,
|
||||||
"simplified_if_return": true,
|
"simplified_if_return": true,
|
||||||
"strict_comparison": true,
|
"strict_comparison": true,
|
||||||
@ -38,7 +22,11 @@
|
|||||||
"trim_array_spaces": true,
|
"trim_array_spaces": true,
|
||||||
"use_arrow_functions": true,
|
"use_arrow_functions": true,
|
||||||
"void_return": true,
|
"void_return": true,
|
||||||
"yoda_style": true,
|
"yoda_style": {
|
||||||
|
"equal": true,
|
||||||
|
"identical": true,
|
||||||
|
"less_and_greater": null
|
||||||
|
},
|
||||||
"array_push": true,
|
"array_push": true,
|
||||||
"assign_null_coalescing_to_coalesce_equal": true,
|
"assign_null_coalescing_to_coalesce_equal": true,
|
||||||
"explicit_indirect_variable": true,
|
"explicit_indirect_variable": true,
|
||||||
@ -49,33 +37,21 @@
|
|||||||
"no_superfluous_elseif": true,
|
"no_superfluous_elseif": true,
|
||||||
"no_useless_else": true,
|
"no_useless_else": true,
|
||||||
"nullable_type_declaration_for_default_null_value": true,
|
"nullable_type_declaration_for_default_null_value": true,
|
||||||
"ordered_imports": {
|
|
||||||
"sort_algorithm": "alpha"
|
"strict_param": true,
|
||||||
|
"date_time_immutable": true,
|
||||||
|
"mb_str_functions": true,
|
||||||
|
"logical_operators": true,
|
||||||
|
"ordered_interfaces": true,
|
||||||
|
"ordered_traits": true,
|
||||||
|
"php_unit_strict": true,
|
||||||
|
"phpdoc_align": {
|
||||||
|
"align": "vertical"
|
||||||
},
|
},
|
||||||
"ordered_class_elements": {
|
"phpdoc_separation": true,
|
||||||
"order": [
|
"return_type_declaration": {
|
||||||
"use_trait",
|
"space_before": "none"
|
||||||
"case",
|
},
|
||||||
"constant",
|
"single_line_throw": false
|
||||||
"constant_public",
|
|
||||||
"constant_protected",
|
|
||||||
"constant_private",
|
|
||||||
"property_public",
|
|
||||||
"property_protected",
|
|
||||||
"property_private",
|
|
||||||
"construct",
|
|
||||||
"destruct",
|
|
||||||
"magic",
|
|
||||||
"phpunit",
|
|
||||||
"method_abstract",
|
|
||||||
"method_public_static",
|
|
||||||
"method_public",
|
|
||||||
"method_protected_static",
|
|
||||||
"method_protected",
|
|
||||||
"method_private_static",
|
|
||||||
"method_private"
|
|
||||||
],
|
|
||||||
"sort_algorithm": "none"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,21 +1,20 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Data\Ui\ConnectedServices\ConnectedServiceCollectionData;
|
|
||||||
use App\Data\Ui\ConnectedServices\ConnectedServiceData;
|
use App\Data\Ui\ConnectedServices\ConnectedServiceData;
|
||||||
use App\Data\Ui\ConnectedServices\ConnectedServicesData;
|
|
||||||
use App\Enums\ConnectionStatus;
|
use App\Enums\ConnectionStatus;
|
||||||
use App\Enums\ConnectionTechTypes;
|
use App\Enums\ConnectionTechTypes;
|
||||||
use Illuminate\Support\Collection;
|
use Illuminate\Support\Collection;
|
||||||
use Livewire\Component;
|
use Livewire\Component;
|
||||||
|
use Spatie\LaravelData\Attributes\DataCollectionOf;
|
||||||
use Spatie\LaravelData\DataCollection;
|
use Spatie\LaravelData\DataCollection;
|
||||||
|
|
||||||
new class extends Component {
|
new class extends Component {
|
||||||
public ConnectedServicesData $connectedServices;
|
#[DataCollectionOf(ConnectedServiceData::class)]
|
||||||
|
public DataCollection $connectedServices;
|
||||||
|
|
||||||
public function mount(): void
|
public function mount(): void
|
||||||
{
|
{
|
||||||
$this->connectedServices = new ConnectedServicesData(
|
$this->connectedServices = ConnectedServiceData::collect([
|
||||||
services: new ConnectedServiceCollectionData([
|
|
||||||
new ConnectedServiceData(
|
new ConnectedServiceData(
|
||||||
name: 'Microsoft Outlook',
|
name: 'Microsoft Outlook',
|
||||||
icon: 'home',
|
icon: 'home',
|
||||||
@ -44,14 +43,13 @@ public function mount(): void
|
|||||||
connectionService: 'Redmine',
|
connectionService: 'Redmine',
|
||||||
status: ConnectionStatus::Error
|
status: ConnectionStatus::Error
|
||||||
),
|
),
|
||||||
])
|
], DataCollection::class);
|
||||||
);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<div class="flex overflow-x-auto gap-x-4">
|
<div class="flex overflow-x-auto gap-x-4">
|
||||||
@foreach ($connectedServices->services as $service)
|
@foreach ($connectedServices as $service)
|
||||||
<x-shared.card class="min-w-60">
|
<x-shared.card class="min-w-60">
|
||||||
<div class="flex space-x-4">
|
<div class="flex space-x-4">
|
||||||
<div class="bg-blue-200 p-4 rounded-lg flex items-center justify-center max-h-10">
|
<div class="bg-blue-200 p-4 rounded-lg flex items-center justify-center max-h-10">
|
||||||
|
|||||||
@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use App\Data\Ui\ManageRoles\RoleData;
|
use App\Data\Ui\ManageRoles\{RoleData,ServiceData};
|
||||||
use App\Data\Ui\ManageRoles\ServiceData;
|
|
||||||
use App\Data\Ui\TableHeader;
|
use App\Data\Ui\TableHeader;
|
||||||
use App\Data\Users\UserData;
|
use App\Data\Users\UserData;
|
||||||
use App\Enums\RolesStatus;
|
use App\Enums\RolesStatus;
|
||||||
|
|||||||
@ -2,9 +2,7 @@
|
|||||||
|
|
||||||
declare(strict_types=1);
|
declare(strict_types=1);
|
||||||
|
|
||||||
use App\Livewire\Settings\Appearance;
|
use App\Livewire\Settings\{Appearance, Profile, Security};
|
||||||
use App\Livewire\Settings\Profile;
|
|
||||||
use App\Livewire\Settings\Security;
|
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
use Laravel\Fortify\Features;
|
use Laravel\Fortify\Features;
|
||||||
|
|
||||||
|
|||||||
@ -4,8 +4,7 @@
|
|||||||
|
|
||||||
use App\Models\User;
|
use App\Models\User;
|
||||||
use Illuminate\Auth\Events\Verified;
|
use Illuminate\Auth\Events\Verified;
|
||||||
use Illuminate\Support\Facades\Event;
|
use Illuminate\Support\Facades\{Event, URL};
|
||||||
use Illuminate\Support\Facades\URL;
|
|
||||||
use Laravel\Fortify\Features;
|
use Laravel\Fortify\Features;
|
||||||
|
|
||||||
beforeEach(function (): void {
|
beforeEach(function (): void {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user