Apply style
This commit is contained in:
@@ -27,23 +27,23 @@ class ServerData extends Data
|
||||
#[StringType]
|
||||
public ?string $status = null,
|
||||
#[StringType,
|
||||
AlphaDash,
|
||||
Max(40)]
|
||||
AlphaDash,
|
||||
Max(40)]
|
||||
public string $name,
|
||||
#[NotIn(0),
|
||||
Exists(Provider::class, 'id')]
|
||||
Exists(Provider::class, 'id')]
|
||||
public int $provider_id,
|
||||
#[NotIn(0),
|
||||
Exists(ProviderRegion::class, 'id')]
|
||||
Exists(ProviderRegion::class, 'id')]
|
||||
public int $provider_region_id,
|
||||
#[NotIn(0),
|
||||
Exists(ProviderPlan::class, 'id')]
|
||||
Exists(ProviderPlan::class, 'id')]
|
||||
public int $provider_plan_id,
|
||||
#[StringType,
|
||||
In(['mysql', 'mariadb', 'postgresql', 'postgresql13'])]
|
||||
In(['mysql', 'mariadb', 'postgresql', 'postgresql13'])]
|
||||
public string $database_type,
|
||||
#[Exists(User::class, 'id'),
|
||||
IntegerType]
|
||||
IntegerType]
|
||||
public ?int $user_id = null,
|
||||
public ?Carbon $created_at = null,
|
||||
) {
|
||||
|
||||
@@ -28,7 +28,7 @@ class SiteData extends Data
|
||||
#[StringType, CustomRule(Hostname::class, ValidateMaximumSites::class)]
|
||||
public ?string $domain = null,
|
||||
#[Exists(User::class, 'id'),
|
||||
IntegerType]
|
||||
IntegerType]
|
||||
public ?int $user_id = null,
|
||||
public ?Carbon $created_at = null,
|
||||
) {
|
||||
|
||||
@@ -2,20 +2,13 @@
|
||||
|
||||
namespace App\DataTransferObjects\Support;
|
||||
|
||||
use Illuminate\Contracts\Pagination\CursorPaginator;
|
||||
use Illuminate\Support\Enumerable;
|
||||
use Spatie\LaravelData\DataCollection;
|
||||
use Illuminate\Pagination\AbstractPaginator;
|
||||
use Illuminate\Contracts\Pagination\Paginator;
|
||||
use Illuminate\Pagination\AbstractCursorPaginator;
|
||||
|
||||
class Data extends \Spatie\LaravelData\Data
|
||||
{
|
||||
/**
|
||||
* When working with paginated data, we want to include pagination details in JSON
|
||||
* responses from the API. However, due to legacy requirements Ploi Core is using
|
||||
* a different structure than this package assumes. Therefore, we will override
|
||||
* the data collection, register a custom transformer and output the structure.
|
||||
*/
|
||||
protected static string $_paginatedCollectionClass = PaginatedDataCollection::class;
|
||||
/**
|
||||
* When working with paginated data, we want to include pagination details in JSON
|
||||
* responses from the API. However, due to legacy requirements Ploi Core is using
|
||||
* a different structure than this package assumes. Therefore, we will override
|
||||
* the data collection, register a custom transformer and output the structure.
|
||||
*/
|
||||
protected static string $_paginatedCollectionClass = PaginatedDataCollection::class;
|
||||
}
|
||||
|
||||
@@ -6,9 +6,9 @@ class DataCollectableTransformer extends \Spatie\LaravelData\Transformers\DataCo
|
||||
{
|
||||
protected function wrapPaginatedArray(array $paginated): array
|
||||
{
|
||||
$wrapKey = $this->wrap->getKey() ?? 'data';
|
||||
|
||||
return [
|
||||
$wrapKey = $this->wrap->getKey() ?? 'data';
|
||||
|
||||
return [
|
||||
$wrapKey => $paginated['data'],
|
||||
'links' => [
|
||||
'first' => $paginated['first_page_url'],
|
||||
|
||||
@@ -6,18 +6,18 @@ use Spatie\LaravelData\Support\Wrapping\WrapExecutionType;
|
||||
|
||||
class PaginatedDataCollection extends \Spatie\LaravelData\PaginatedDataCollection
|
||||
{
|
||||
public function transform(bool $transformValues = true, WrapExecutionType $wrapExecutionType = WrapExecutionType::Disabled, bool $mapPropertyNames = true,): array
|
||||
{
|
||||
$transformer = new DataCollectableTransformer(
|
||||
$this->dataClass,
|
||||
$transformValues,
|
||||
$wrapExecutionType,
|
||||
$mapPropertyNames,
|
||||
$this->getPartialTrees(),
|
||||
$this->items,
|
||||
$this->getWrap(),
|
||||
);
|
||||
|
||||
return $transformer->transform();
|
||||
}
|
||||
public function transform(bool $transformValues = true, WrapExecutionType $wrapExecutionType = WrapExecutionType::Disabled, bool $mapPropertyNames = true): array
|
||||
{
|
||||
$transformer = new DataCollectableTransformer(
|
||||
$this->dataClass,
|
||||
$transformValues,
|
||||
$wrapExecutionType,
|
||||
$mapPropertyNames,
|
||||
$this->getPartialTrees(),
|
||||
$this->items,
|
||||
$this->getWrap(),
|
||||
);
|
||||
|
||||
return $transformer->transform();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
namespace App\DataTransferObjects\Support\Rules;
|
||||
|
||||
use Attribute;
|
||||
use Spatie\LaravelData\Attributes\Validation\CustomValidationAttribute;
|
||||
use Spatie\LaravelData\Support\Validation\ValidationPath;
|
||||
use Spatie\LaravelData\Attributes\Validation\CustomValidationAttribute;
|
||||
|
||||
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_PARAMETER)]
|
||||
class CustomRule extends CustomValidationAttribute
|
||||
@@ -22,7 +22,7 @@ class CustomRule extends CustomValidationAttribute
|
||||
public function getRules(ValidationPath $path): array|object|string
|
||||
{
|
||||
return array_map(
|
||||
fn(string $ruleClass) => new $ruleClass(),
|
||||
fn (string $ruleClass) => new $ruleClass(),
|
||||
$this->rules
|
||||
);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ class CarbonTransformer implements Transformer
|
||||
{
|
||||
public function transform(DataProperty $property, mixed $value): string
|
||||
{
|
||||
/** @var Carbon $value */
|
||||
/** @var Carbon $value */
|
||||
return $value->toISOString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,15 +20,15 @@ class UserData extends Data
|
||||
public ?int $id = null,
|
||||
public ?string $avatar = null,
|
||||
#[StringType,
|
||||
Max(255)]
|
||||
Max(255)]
|
||||
public ?string $name = null,
|
||||
#[StringType,
|
||||
Email,
|
||||
Max(255),
|
||||
Unique(User::class)]
|
||||
Email,
|
||||
Max(255),
|
||||
Unique(User::class)]
|
||||
public ?string $email = null,
|
||||
#[Exists(Package::class, 'id'),
|
||||
IntegerType]
|
||||
IntegerType]
|
||||
public ?int $package_id = null,
|
||||
#[StringType]
|
||||
public ?string $blocked = null,
|
||||
|
||||
@@ -8,9 +8,9 @@ use App\Models\Certificate;
|
||||
use Filament\Resources\Form;
|
||||
use Filament\Resources\Table;
|
||||
use Filament\Resources\Resource;
|
||||
use Illuminate\Support\HtmlString;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use App\Filament\Resources\CertificateResource\Pages;
|
||||
use Illuminate\Support\HtmlString;
|
||||
|
||||
class CertificateResource extends Resource
|
||||
{
|
||||
|
||||
@@ -63,7 +63,7 @@ class UserResource extends Resource
|
||||
Forms\Components\Select::make('language')
|
||||
->label(__('Language'))
|
||||
->default('en')
|
||||
->options(collect(languages())->mapWithKeys(fn(string $language) => [$language => $language])),
|
||||
->options(collect(languages())->mapWithKeys(fn (string $language) => [$language => $language])),
|
||||
Forms\Components\Textarea::make('notes')
|
||||
->label(__('Notes'))
|
||||
->maxLength(65535),
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
namespace App\Filament\Resources\UserResource\Pages;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Filament\Resources\UserResource;
|
||||
use Filament\Resources\Pages\CreateRecord;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class CreateUser extends CreateRecord
|
||||
{
|
||||
|
||||
@@ -5,10 +5,10 @@ namespace App\Filament\Resources\UserResource\Pages;
|
||||
use Filament\Pages\Actions;
|
||||
use Filament\Forms\Components\Toggle;
|
||||
use App\Actions\User\DeleteUserAction;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use App\Filament\Resources\UserResource;
|
||||
use Filament\Notifications\Notification;
|
||||
use Filament\Resources\Pages\EditRecord;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EditUser extends EditRecord
|
||||
{
|
||||
|
||||
@@ -3,9 +3,7 @@
|
||||
namespace App\Http\Middleware;
|
||||
|
||||
use Closure;
|
||||
use Filament\Notifications\Notification;
|
||||
use Illuminate\Http\Request;
|
||||
use Livewire\Livewire;
|
||||
|
||||
class Demo
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user