mirror of
https://github.com/filamentphp/filament.git
synced 2026-08-31 01:14:50 +08:00
cs
This commit is contained in:
+1
-1
@@ -14,7 +14,7 @@ use Livewire\LivewireServiceProvider;
|
||||
use Orchestra\Testbench\Concerns\CreatesApplication;
|
||||
use Orchestra\Testbench\Foundation\Application;
|
||||
|
||||
$basePathLocator = new class()
|
||||
$basePathLocator = new class
|
||||
{
|
||||
use CreatesApplication;
|
||||
};
|
||||
|
||||
@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class() extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
||||
@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class() extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
||||
@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class() extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
|
||||
@@ -41,7 +41,7 @@ class ActionsServiceProvider extends PackageServiceProvider
|
||||
}
|
||||
}
|
||||
|
||||
Testable::mixin(new TestsActions());
|
||||
Testable::mixin(new TestsActions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -330,7 +330,7 @@ trait CanImportRecords
|
||||
->action(function (): StreamedResponse {
|
||||
$columns = $this->getImporter()::getColumns();
|
||||
|
||||
$csv = Writer::createFromFileObject(new SplTempFileObject());
|
||||
$csv = Writer::createFromFileObject(new SplTempFileObject);
|
||||
$csv->setOutputBOM(ByteSequence::BOM_UTF8);
|
||||
|
||||
if (filled($csvDelimiter = $this->getCsvDelimiter())) {
|
||||
|
||||
@@ -31,7 +31,7 @@ trait HasExtraModalWindowAttributes
|
||||
*/
|
||||
public function getExtraModalWindowAttributes(): array
|
||||
{
|
||||
$temporaryAttributeBag = new ComponentAttributeBag();
|
||||
$temporaryAttributeBag = new ComponentAttributeBag;
|
||||
|
||||
foreach ($this->extraModalWindowAttributes as $extraModalWindowAttributes) {
|
||||
$temporaryAttributeBag = $temporaryAttributeBag->merge($this->evaluate($extraModalWindowAttributes));
|
||||
|
||||
@@ -54,7 +54,7 @@ class CreateAction extends Action
|
||||
if ($translatableContentDriver = $livewire->makeFilamentTranslatableContentDriver()) {
|
||||
$record = $translatableContentDriver->makeRecord($model, $data);
|
||||
} else {
|
||||
$record = new $model();
|
||||
$record = new $model;
|
||||
$record->fill($data);
|
||||
}
|
||||
|
||||
|
||||
@@ -75,7 +75,7 @@ class ExportCsv implements ShouldQueue
|
||||
$processedRows = 0;
|
||||
$successfulRows = 0;
|
||||
|
||||
$csv = Writer::createFromFileObject(new SplTempFileObject());
|
||||
$csv = Writer::createFromFileObject(new SplTempFileObject);
|
||||
$csv->setDelimiter($this->exporter::getCsvDelimiter());
|
||||
|
||||
$query = EloquentSerializeFacade::unserialize($this->query);
|
||||
|
||||
@@ -52,7 +52,7 @@ class PrepareCsvExport implements ShouldQueue
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
$csv = Writer::createFromFileObject(new SplTempFileObject());
|
||||
$csv = Writer::createFromFileObject(new SplTempFileObject);
|
||||
$csv->setOutputBOM(ByteSequence::BOM_UTF8);
|
||||
$csv->setDelimiter($this->exporter::getCsvDelimiter());
|
||||
$csv->insertOne(array_values($this->columnMap));
|
||||
|
||||
@@ -22,7 +22,7 @@ class DownloadImportFailureCsv
|
||||
abort_unless($import->user()->is(auth()->user()), 403);
|
||||
}
|
||||
|
||||
$csv = Writer::createFromFileObject(new SplTempFileObject());
|
||||
$csv = Writer::createFromFileObject(new SplTempFileObject);
|
||||
$csv->setOutputBOM(ByteSequence::BOM_UTF8);
|
||||
|
||||
$columnHeaders = array_keys($import->failedRows()->first()->data);
|
||||
|
||||
@@ -43,12 +43,12 @@ abstract class MountableAction extends StaticAction implements HasLivewire
|
||||
|
||||
public function cancel(bool $shouldRollBackDatabaseTransaction = false): void
|
||||
{
|
||||
throw (new Cancel())->rollBackDatabaseTransaction($shouldRollBackDatabaseTransaction);
|
||||
throw (new Cancel)->rollBackDatabaseTransaction($shouldRollBackDatabaseTransaction);
|
||||
}
|
||||
|
||||
public function halt(bool $shouldRollBackDatabaseTransaction = false): void
|
||||
{
|
||||
throw (new Halt())->rollBackDatabaseTransaction($shouldRollBackDatabaseTransaction);
|
||||
throw (new Halt)->rollBackDatabaseTransaction($shouldRollBackDatabaseTransaction);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -64,7 +64,7 @@ trait EntanglesStateWithSingularRelationship
|
||||
if ($translatableContentDriver) {
|
||||
$record = $translatableContentDriver->makeRecord($relatedModel, $data);
|
||||
} else {
|
||||
$record = new $relatedModel();
|
||||
$record = new $relatedModel;
|
||||
$record->fill($data);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ trait EntanglesStateWithSingularRelationship
|
||||
if ($translatableContentDriver) {
|
||||
$record = $translatableContentDriver->makeRecord($relatedModel, $data);
|
||||
} else {
|
||||
$record = new $relatedModel();
|
||||
$record = new $relatedModel;
|
||||
$record->fill($data);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ trait HasExtraFieldWrapperAttributes
|
||||
*/
|
||||
public function getExtraFieldWrapperAttributes(): array
|
||||
{
|
||||
$temporaryAttributeBag = new ComponentAttributeBag();
|
||||
$temporaryAttributeBag = new ComponentAttributeBag;
|
||||
|
||||
foreach ($this->extraFieldWrapperAttributes as $extraFieldWrapperAttributes) {
|
||||
$temporaryAttributeBag = $temporaryAttributeBag->merge($this->evaluate($extraFieldWrapperAttributes));
|
||||
|
||||
@@ -31,7 +31,7 @@ trait HasExtraInputAttributes
|
||||
*/
|
||||
public function getExtraInputAttributes(): array
|
||||
{
|
||||
$temporaryAttributeBag = new ComponentAttributeBag();
|
||||
$temporaryAttributeBag = new ComponentAttributeBag;
|
||||
|
||||
foreach ($this->extraInputAttributes as $extraInputAttributes) {
|
||||
$temporaryAttributeBag = $temporaryAttributeBag->merge($this->evaluate($extraInputAttributes));
|
||||
|
||||
@@ -368,7 +368,7 @@ class DateTimePicker extends Field implements Contracts\HasAffixActions
|
||||
*/
|
||||
public function getExtraTriggerAttributes(): array
|
||||
{
|
||||
$temporaryAttributeBag = new ComponentAttributeBag();
|
||||
$temporaryAttributeBag = new ComponentAttributeBag;
|
||||
|
||||
foreach ($this->extraTriggerAttributes as $extraTriggerAttributes) {
|
||||
$temporaryAttributeBag = $temporaryAttributeBag->merge($this->evaluate($extraTriggerAttributes));
|
||||
|
||||
@@ -943,7 +943,7 @@ class Repeater extends Field implements Contracts\CanConcealComponents, Contract
|
||||
if ($translatableContentDriver) {
|
||||
$record = $translatableContentDriver->makeRecord($relatedModel, $itemData);
|
||||
} else {
|
||||
$record = new $relatedModel();
|
||||
$record = new $relatedModel;
|
||||
$record->fill($itemData);
|
||||
}
|
||||
|
||||
|
||||
@@ -46,8 +46,8 @@ class FormsServiceProvider extends PackageServiceProvider
|
||||
}
|
||||
}
|
||||
|
||||
Testable::mixin(new TestsForms());
|
||||
Testable::mixin(new TestsComponentActions());
|
||||
Testable::mixin(new TestsForms);
|
||||
Testable::mixin(new TestsComponentActions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -31,7 +31,7 @@ trait HasExtraEntryWrapperAttributes
|
||||
*/
|
||||
public function getExtraEntryWrapperAttributes(): array
|
||||
{
|
||||
$temporaryAttributeBag = new ComponentAttributeBag();
|
||||
$temporaryAttributeBag = new ComponentAttributeBag;
|
||||
|
||||
foreach ($this->extraEntryWrapperAttributes as $extraEntryWrapperAttributes) {
|
||||
$temporaryAttributeBag = $temporaryAttributeBag->merge($this->evaluate($extraEntryWrapperAttributes));
|
||||
|
||||
@@ -20,7 +20,7 @@ class InfolistsServiceProvider extends PackageServiceProvider
|
||||
|
||||
public function packageBooted(): void
|
||||
{
|
||||
Testable::mixin(new TestsActions());
|
||||
Testable::mixin(new TestsActions);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -27,7 +27,7 @@ class Notifications extends Component
|
||||
|
||||
public function mount(): void
|
||||
{
|
||||
$this->notifications = new Collection();
|
||||
$this->notifications = new Collection;
|
||||
$this->pullNotificationsFromSession();
|
||||
}
|
||||
|
||||
|
||||
@@ -236,7 +236,7 @@ class Notification extends ViewComponent implements Arrayable
|
||||
|
||||
public static function assertNotified(Notification | string | null $notification = null): void
|
||||
{
|
||||
$notificationsLivewireComponent = new Notifications();
|
||||
$notificationsLivewireComponent = new Notifications;
|
||||
$notificationsLivewireComponent->mount();
|
||||
$notifications = $notificationsLivewireComponent->notifications;
|
||||
|
||||
@@ -272,7 +272,7 @@ class Notification extends ViewComponent implements Arrayable
|
||||
|
||||
public static function assertNotNotified(Notification | string | null $notification = null): void
|
||||
{
|
||||
$notificationsLivewireComponent = new Notifications();
|
||||
$notificationsLivewireComponent = new Notifications;
|
||||
$notificationsLivewireComponent->mount();
|
||||
$notifications = $notificationsLivewireComponent->notifications;
|
||||
|
||||
|
||||
@@ -52,6 +52,6 @@ class NotificationsServiceProvider extends PackageServiceProvider
|
||||
$component->dispatch('notificationsSent');
|
||||
});
|
||||
|
||||
Testable::mixin(new TestsNotifications());
|
||||
Testable::mixin(new TestsNotifications);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,15 +45,15 @@ class FilamentServiceProvider extends PackageServiceProvider
|
||||
public function packageRegistered(): void
|
||||
{
|
||||
$this->app->scoped('filament', function (): FilamentManager {
|
||||
return new FilamentManager();
|
||||
return new FilamentManager;
|
||||
});
|
||||
|
||||
$this->app->singleton(PanelRegistry::class, function (): PanelRegistry {
|
||||
return new PanelRegistry();
|
||||
return new PanelRegistry;
|
||||
});
|
||||
|
||||
$this->app->scoped(NavigationManager::class, function (): NavigationManager {
|
||||
return new NavigationManager();
|
||||
return new NavigationManager;
|
||||
});
|
||||
|
||||
$this->app->bind(EmailVerificationResponseContract::class, EmailVerificationResponse::class);
|
||||
|
||||
@@ -126,7 +126,7 @@ abstract class BasePage extends Component implements HasActions, HasForms, HasIn
|
||||
|
||||
protected function halt(): void
|
||||
{
|
||||
throw new Halt();
|
||||
throw new Halt;
|
||||
}
|
||||
|
||||
protected function callHook(string $hook): void
|
||||
|
||||
@@ -188,7 +188,7 @@ trait HasRoutes
|
||||
Filament::setTenant($tenant, isQuiet: true);
|
||||
}
|
||||
|
||||
$this->navigationManager = new NavigationManager();
|
||||
$this->navigationManager = new NavigationManager;
|
||||
|
||||
$navigation = $this->navigationManager->get();
|
||||
|
||||
|
||||
@@ -189,7 +189,7 @@ trait HasTenancy
|
||||
->resolveRouteBinding($key, $this->getTenantSlugAttribute());
|
||||
|
||||
if ($record === null) {
|
||||
throw (new ModelNotFoundException())->setModel($tenantModel, [$key]);
|
||||
throw (new ModelNotFoundException)->setModel($tenantModel, [$key]);
|
||||
}
|
||||
|
||||
return $record;
|
||||
|
||||
@@ -23,7 +23,7 @@ trait InteractsWithRecord
|
||||
$record = static::getResource()::resolveRecordRouteBinding($key);
|
||||
|
||||
if ($record === null) {
|
||||
throw (new ModelNotFoundException())->setModel($this->getModel(), [$key]);
|
||||
throw (new ModelNotFoundException)->setModel($this->getModel(), [$key]);
|
||||
}
|
||||
|
||||
return $record;
|
||||
|
||||
@@ -34,7 +34,7 @@ if (! function_exists('Filament\authorize')) {
|
||||
);
|
||||
|
||||
if ($response === false) {
|
||||
throw new AuthorizationException();
|
||||
throw new AuthorizationException;
|
||||
}
|
||||
|
||||
if (! $response instanceof Response) {
|
||||
|
||||
@@ -16,7 +16,7 @@ class SpatieTagsInput extends TagsInput
|
||||
{
|
||||
parent::setUp();
|
||||
|
||||
$this->type(new AllTagTypes());
|
||||
$this->type(new AllTagTypes);
|
||||
|
||||
$this->loadStateFromRelationshipsUsing(static function (SpatieTagsInput $component, ?Model $record): void {
|
||||
if (! method_exists($record, 'tagsWithType')) {
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ class SpatieLaravelTranslatableContentDriver implements TranslatableContentDrive
|
||||
*/
|
||||
public function makeRecord(string $model, array $data): Model
|
||||
{
|
||||
$record = new $model();
|
||||
$record = new $model;
|
||||
|
||||
if (method_exists($record, 'setLocale')) {
|
||||
$record->setLocale($this->activeLocale);
|
||||
|
||||
@@ -176,7 +176,7 @@
|
||||
x-transition:leave-end="scale-95 opacity-0"
|
||||
@endif
|
||||
{{
|
||||
($extraModalWindowAttributeBag ?? new \Illuminate\View\ComponentAttributeBag())->class([
|
||||
($extraModalWindowAttributeBag ?? new \Illuminate\View\ComponentAttributeBag)->class([
|
||||
'fi-modal-window pointer-events-auto relative row-start-2 flex w-full cursor-default flex-col bg-white shadow-xl ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10',
|
||||
'fi-modal-slide-over-window ms-auto overflow-y-auto' => $slideOver,
|
||||
// Using an arbitrary value instead of the h-dvh class that was added in Tailwind CSS v3.4.0
|
||||
|
||||
@@ -34,7 +34,7 @@ class ComponentManager implements ScopedComponentManager
|
||||
|
||||
app()->singletonIf(
|
||||
ComponentManager::class,
|
||||
fn () => new ComponentManager(),
|
||||
fn () => new ComponentManager,
|
||||
);
|
||||
|
||||
return app(ComponentManager::class);
|
||||
|
||||
@@ -111,7 +111,7 @@ abstract class ViewComponent extends Component implements Htmlable
|
||||
return view(
|
||||
$this->getView(),
|
||||
[
|
||||
'attributes' => new ComponentAttributeBag(),
|
||||
'attributes' => new ComponentAttributeBag,
|
||||
...$this->extractPublicMethods(),
|
||||
...(isset($this->viewIdentifier) ? [$this->viewIdentifier => $this] : []),
|
||||
...$this->viewData,
|
||||
|
||||
@@ -31,7 +31,7 @@ trait HasExtraAlpineAttributes
|
||||
*/
|
||||
public function getExtraAlpineAttributes(): array
|
||||
{
|
||||
$temporaryAttributeBag = new ComponentAttributeBag();
|
||||
$temporaryAttributeBag = new ComponentAttributeBag;
|
||||
|
||||
foreach ($this->extraAlpineAttributes as $extraAlpineAttributes) {
|
||||
$temporaryAttributeBag = $temporaryAttributeBag->merge($this->evaluate($extraAlpineAttributes));
|
||||
|
||||
@@ -31,7 +31,7 @@ trait HasExtraAttributes
|
||||
*/
|
||||
public function getExtraAttributes(): array
|
||||
{
|
||||
$temporaryAttributeBag = new ComponentAttributeBag();
|
||||
$temporaryAttributeBag = new ComponentAttributeBag;
|
||||
|
||||
foreach ($this->extraAttributes as $extraAttributes) {
|
||||
$temporaryAttributeBag = $temporaryAttributeBag->merge($this->evaluate($extraAttributes));
|
||||
|
||||
@@ -31,7 +31,7 @@ trait HasExtraSidebarAttributes
|
||||
*/
|
||||
public function getExtraSidebarAttributes(): array
|
||||
{
|
||||
$temporaryAttributeBag = new ComponentAttributeBag();
|
||||
$temporaryAttributeBag = new ComponentAttributeBag;
|
||||
|
||||
foreach ($this->extraSidebarAttributes as $extraSidebarAttributes) {
|
||||
$temporaryAttributeBag = $temporaryAttributeBag->merge($this->evaluate($extraSidebarAttributes));
|
||||
|
||||
@@ -31,7 +31,7 @@ trait HasExtraTopbarAttributes
|
||||
*/
|
||||
public function getExtraTopbarAttributes(): array
|
||||
{
|
||||
$temporaryAttributeBag = new ComponentAttributeBag();
|
||||
$temporaryAttributeBag = new ComponentAttributeBag;
|
||||
|
||||
foreach ($this->extraTopbarAttributes as $extraTopbarAttributes) {
|
||||
$temporaryAttributeBag = $temporaryAttributeBag->merge($this->evaluate($extraTopbarAttributes));
|
||||
|
||||
@@ -57,7 +57,7 @@ class SupportServiceProvider extends PackageServiceProvider
|
||||
{
|
||||
$this->app->scoped(
|
||||
AssetManager::class,
|
||||
fn () => new AssetManager(),
|
||||
fn () => new AssetManager,
|
||||
);
|
||||
|
||||
$this->app->scoped(
|
||||
@@ -69,23 +69,23 @@ class SupportServiceProvider extends PackageServiceProvider
|
||||
|
||||
$this->app->scoped(
|
||||
ColorManager::class,
|
||||
fn () => new ColorManager(),
|
||||
fn () => new ColorManager,
|
||||
);
|
||||
|
||||
$this->app->scoped(
|
||||
IconManager::class,
|
||||
fn () => new IconManager(),
|
||||
fn () => new IconManager,
|
||||
);
|
||||
|
||||
$this->app->scoped(
|
||||
ViewManager::class,
|
||||
fn () => new ViewManager(),
|
||||
fn () => new ViewManager,
|
||||
);
|
||||
|
||||
$this->app->scoped(
|
||||
HtmlSanitizerInterface::class,
|
||||
fn (): HtmlSanitizer => new HtmlSanitizer(
|
||||
(new HtmlSanitizerConfig())
|
||||
(new HtmlSanitizerConfig)
|
||||
->allowSafeElements()
|
||||
->allowRelativeLinks()
|
||||
->allowRelativeMedias()
|
||||
|
||||
@@ -50,7 +50,7 @@ if (! function_exists('Filament\Support\get_model_label')) {
|
||||
if (! function_exists('Filament\Support\locale_has_pluralization')) {
|
||||
function locale_has_pluralization(): bool
|
||||
{
|
||||
return (new MessageSelector())->getPluralIndex(app()->getLocale(), 10) > 0;
|
||||
return (new MessageSelector)->getPluralIndex(app()->getLocale(), 10) > 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ class CreateAction extends Action
|
||||
if ($translatableContentDriver = $table->makeTranslatableContentDriver()) {
|
||||
$record = $translatableContentDriver->makeRecord($model, $data);
|
||||
} else {
|
||||
$record = new $model();
|
||||
$record = new $model;
|
||||
$record->fill($data);
|
||||
}
|
||||
|
||||
|
||||
@@ -31,7 +31,7 @@ trait HasExtraCellAttributes
|
||||
*/
|
||||
public function getExtraCellAttributes(): array
|
||||
{
|
||||
$temporaryAttributeBag = new ComponentAttributeBag();
|
||||
$temporaryAttributeBag = new ComponentAttributeBag;
|
||||
|
||||
foreach ($this->extraCellAttributes as $extraCellAttributes) {
|
||||
$temporaryAttributeBag = $temporaryAttributeBag->merge($this->evaluate($extraCellAttributes));
|
||||
|
||||
@@ -31,7 +31,7 @@ trait HasExtraHeaderAttributes
|
||||
*/
|
||||
public function getExtraHeaderAttributes(): array
|
||||
{
|
||||
$temporaryAttributeBag = new ComponentAttributeBag();
|
||||
$temporaryAttributeBag = new ComponentAttributeBag;
|
||||
|
||||
foreach ($this->extraHeaderAttributes as $extraHeaderAttributes) {
|
||||
$temporaryAttributeBag = $temporaryAttributeBag->merge($this->evaluate($extraHeaderAttributes));
|
||||
|
||||
@@ -239,7 +239,7 @@ class ImageColumn extends Column
|
||||
*/
|
||||
public function getExtraImgAttributes(): array
|
||||
{
|
||||
$temporaryAttributeBag = new ComponentAttributeBag();
|
||||
$temporaryAttributeBag = new ComponentAttributeBag;
|
||||
|
||||
foreach ($this->extraImgAttributes as $extraImgAttributes) {
|
||||
$temporaryAttributeBag = $temporaryAttributeBag->merge($this->evaluate($extraImgAttributes));
|
||||
|
||||
@@ -40,12 +40,12 @@ class TablesServiceProvider extends PackageServiceProvider
|
||||
}
|
||||
}
|
||||
|
||||
Testable::mixin(new TestsActions());
|
||||
Testable::mixin(new TestsBulkActions());
|
||||
Testable::mixin(new TestsColumns());
|
||||
Testable::mixin(new TestsFilters());
|
||||
Testable::mixin(new TestsRecords());
|
||||
Testable::mixin(new TestsSummaries());
|
||||
Testable::mixin(new TestsActions);
|
||||
Testable::mixin(new TestsBulkActions);
|
||||
Testable::mixin(new TestsColumns);
|
||||
Testable::mixin(new TestsFilters);
|
||||
Testable::mixin(new TestsRecords);
|
||||
Testable::mixin(new TestsSummaries);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class() extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class() extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class() extends Migration
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
|
||||
@@ -23,7 +23,7 @@ it('has components', function () {
|
||||
$components = [];
|
||||
|
||||
foreach (range(1, $count = rand(2, 10)) as $i) {
|
||||
$components[] = new Component();
|
||||
$components[] = new Component;
|
||||
}
|
||||
|
||||
$componentsBoundToContainer = ($container = ComponentContainer::make(Livewire::make()))
|
||||
@@ -43,7 +43,7 @@ it('has dynamic components', function () {
|
||||
$components = [];
|
||||
|
||||
foreach (range(1, $count = rand(2, 10)) as $i) {
|
||||
$components[] = new Component();
|
||||
$components[] = new Component;
|
||||
}
|
||||
|
||||
$componentsBoundToContainer = ($container = ComponentContainer::make(Livewire::make()))
|
||||
@@ -61,7 +61,7 @@ it('has dynamic components', function () {
|
||||
|
||||
it('belongs to parent component', function () {
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->parentComponent($component = new Component());
|
||||
->parentComponent($component = new Component);
|
||||
|
||||
expect($container)
|
||||
->getParentComponent()->toBe($component);
|
||||
|
||||
@@ -9,7 +9,7 @@ use Illuminate\Support\Str;
|
||||
uses(TestCase::class);
|
||||
|
||||
it('belongs to container', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container($container = ComponentContainer::make(Livewire::make()));
|
||||
|
||||
expect($component)
|
||||
@@ -17,7 +17,7 @@ it('belongs to container', function () {
|
||||
});
|
||||
|
||||
it('can access container\'s Livewire component', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(ComponentContainer::make($livewire = Livewire::make()));
|
||||
|
||||
expect($component)
|
||||
@@ -28,10 +28,10 @@ it('has child components', function () {
|
||||
$components = [];
|
||||
|
||||
foreach (range(1, $count = rand(2, 10)) as $i) {
|
||||
$components[] = new Component();
|
||||
$components[] = new Component;
|
||||
}
|
||||
|
||||
$componentsBoundToContainer = ($parentComponent = new Component())
|
||||
$componentsBoundToContainer = ($parentComponent = new Component)
|
||||
->container(ComponentContainer::make(Livewire::make()))
|
||||
->childComponents($components)
|
||||
->getChildComponentContainer()
|
||||
@@ -47,7 +47,7 @@ it('has child components', function () {
|
||||
});
|
||||
|
||||
it('has a label', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(ComponentContainer::make(Livewire::make()))
|
||||
->label($label = Str::random());
|
||||
|
||||
@@ -56,7 +56,7 @@ it('has a label', function () {
|
||||
});
|
||||
|
||||
it('can have meta', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->meta('foo', 'bar')
|
||||
->meta('bob', 'baz');
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ test('registered event listeners are executed', function () {
|
||||
|
||||
ComponentContainer::make(Livewire::make())
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->registerListeners([
|
||||
$event => [
|
||||
fn () => throw new Exception($event),
|
||||
|
||||
@@ -14,7 +14,7 @@ class Livewire extends Component implements HasForms
|
||||
|
||||
public static function make(): static
|
||||
{
|
||||
return new static();
|
||||
return new static;
|
||||
}
|
||||
|
||||
public function mount(): void
|
||||
|
||||
@@ -40,7 +40,7 @@ test('can get number of container columns at one breakpoint', function () {
|
||||
|
||||
test('can get number of container columns from parent component', function () {
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->parentComponent((new Component())->columns([
|
||||
->parentComponent((new Component)->columns([
|
||||
'default' => $defaultColumns = rand(1, 12),
|
||||
'sm' => $columnsAtSm = rand(1, 12),
|
||||
'md' => $columnsAtMd = rand(1, 12),
|
||||
@@ -68,7 +68,7 @@ test('can set number of container columns at `lg` breakpoint', function () {
|
||||
});
|
||||
|
||||
test('can get component column span at all breakpoints', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(ComponentContainer::make(Livewire::make()))
|
||||
->columnSpan([
|
||||
'default' => $defaultSpan = rand(1, 12),
|
||||
@@ -90,7 +90,7 @@ test('can get component column span at all breakpoints', function () {
|
||||
});
|
||||
|
||||
test('can get component column span at one breakpoint', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(ComponentContainer::make(Livewire::make()))
|
||||
->columnSpan([
|
||||
'2xl' => $spanAt2xl = rand(1, 12),
|
||||
@@ -101,7 +101,7 @@ test('can get component column span at one breakpoint', function () {
|
||||
});
|
||||
|
||||
test('can set component column span at `default` breakpoint', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(ComponentContainer::make(Livewire::make()))
|
||||
->columnSpan($defaultSpan = rand(1, 12));
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ use Illuminate\Support\Str;
|
||||
uses(TestCase::class);
|
||||
|
||||
test('components can be hidden', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(ComponentContainer::make(Livewire::make()))
|
||||
->hidden();
|
||||
|
||||
@@ -23,7 +23,7 @@ test('components can be hidden based on condition', function () {
|
||||
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->visible(fn (callable $get) => $get($statePath) === false),
|
||||
])
|
||||
->fill([
|
||||
@@ -34,7 +34,7 @@ test('components can be hidden based on condition', function () {
|
||||
->toHaveCount(0);
|
||||
|
||||
$container->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->whenTruthy($statePath),
|
||||
]);
|
||||
|
||||
@@ -42,7 +42,7 @@ test('components can be hidden based on condition', function () {
|
||||
->toHaveLength(1);
|
||||
|
||||
$container->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->whenFalsy($statePath),
|
||||
]);
|
||||
|
||||
@@ -51,7 +51,7 @@ test('components can be hidden based on condition', function () {
|
||||
|
||||
$container
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->whenFalsy([$statePath, 'bob']),
|
||||
])
|
||||
->fill([
|
||||
@@ -63,7 +63,7 @@ test('components can be hidden based on condition', function () {
|
||||
|
||||
$container
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->whenTruthy([$statePath, 'bob']),
|
||||
])
|
||||
->fill([
|
||||
@@ -78,11 +78,11 @@ test('hidden components are not returned from container', function () {
|
||||
$components = [];
|
||||
|
||||
foreach (range(1, $visibleCount = rand(2, 10)) as $i) {
|
||||
$components[] = new Component();
|
||||
$components[] = new Component;
|
||||
}
|
||||
|
||||
foreach (range(1, rand(2, 10)) as $i) {
|
||||
$components[] = (new Component())->hidden();
|
||||
$components[] = (new Component)->hidden();
|
||||
}
|
||||
|
||||
$componentsBoundToContainer = ($container = ComponentContainer::make(Livewire::make()))
|
||||
|
||||
@@ -11,7 +11,7 @@ uses(TestCase::class);
|
||||
|
||||
test('containers can store a record', function () {
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->model($record = new Post());
|
||||
->model($record = new Post);
|
||||
|
||||
expect($container)
|
||||
->getRecord()->toBe($record);
|
||||
@@ -24,7 +24,7 @@ test('containers can get their model class', function () {
|
||||
expect($container)
|
||||
->getModel()->toBe($model);
|
||||
|
||||
$container->model(new Post());
|
||||
$container->model(new Post);
|
||||
|
||||
expect($container)
|
||||
->getModel()->toBe($model);
|
||||
@@ -32,7 +32,7 @@ test('containers can get their model class', function () {
|
||||
|
||||
test('containers can get an instance of their model', function () {
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->model($modelInstance = new Post());
|
||||
->model($modelInstance = new Post);
|
||||
|
||||
expect($container)
|
||||
->getModelInstance()->toBe($modelInstance);
|
||||
@@ -44,16 +44,16 @@ test('containers can get an instance of their model', function () {
|
||||
});
|
||||
|
||||
test('components can store a record', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(ComponentContainer::make(Livewire::make()))
|
||||
->model($record = new Post());
|
||||
->model($record = new Post);
|
||||
|
||||
expect($component)
|
||||
->getRecord()->toBe($record);
|
||||
});
|
||||
|
||||
test('components can get their model class', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(ComponentContainer::make(Livewire::make()))
|
||||
->model($model = Post::class);
|
||||
|
||||
@@ -62,7 +62,7 @@ test('components can get their model class', function () {
|
||||
});
|
||||
|
||||
test('components can get an instance of their model', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(ComponentContainer::make(Livewire::make()))
|
||||
->model($model = Post::class);
|
||||
|
||||
@@ -71,10 +71,10 @@ test('components can get an instance of their model', function () {
|
||||
});
|
||||
|
||||
test('components can inherit their container record', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(
|
||||
ComponentContainer::make(Livewire::make())
|
||||
->model($record = new Post()),
|
||||
->model($record = new Post),
|
||||
);
|
||||
|
||||
expect($component)
|
||||
@@ -82,7 +82,7 @@ test('components can inherit their container record', function () {
|
||||
});
|
||||
|
||||
test('components can inherit their container model class', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(
|
||||
ComponentContainer::make(Livewire::make())
|
||||
->model($model = Post::class),
|
||||
@@ -94,10 +94,10 @@ test('components can inherit their container model class', function () {
|
||||
});
|
||||
|
||||
test('components do not inherit their container record if they have their own model defined', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(
|
||||
ComponentContainer::make(Livewire::make())
|
||||
->model(new User()),
|
||||
->model(new User),
|
||||
)
|
||||
->model($model = Post::class);
|
||||
|
||||
|
||||
@@ -28,14 +28,14 @@ test('fields can have state binding modifiers', function () {
|
||||
});
|
||||
|
||||
test('component state binding is deferred by default', function () {
|
||||
$component = (new Component())->container(ComponentContainer::make(Livewire::make()));
|
||||
$component = (new Component)->container(ComponentContainer::make(Livewire::make()));
|
||||
|
||||
expect($component)
|
||||
->getStateBindingModifiers()->toBe([]);
|
||||
});
|
||||
|
||||
test('component state binding can be live', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(ComponentContainer::make(Livewire::make()))
|
||||
->live();
|
||||
|
||||
@@ -44,7 +44,7 @@ test('component state binding can be live', function () {
|
||||
});
|
||||
|
||||
test('component state binding can be triggered on blur', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(ComponentContainer::make(Livewire::make()))
|
||||
->live(onBlur: true);
|
||||
|
||||
@@ -53,7 +53,7 @@ test('component state binding can be triggered on blur', function () {
|
||||
});
|
||||
|
||||
test('component state binding can be debounced', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(ComponentContainer::make(Livewire::make()))
|
||||
->live(debounce: '750ms');
|
||||
|
||||
@@ -62,11 +62,11 @@ test('component state binding can be debounced', function () {
|
||||
});
|
||||
|
||||
test('components inherit their state binding modifiers', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(
|
||||
ComponentContainer::make(Livewire::make())
|
||||
->parentComponent(
|
||||
(new Component())->stateBindingModifiers($modifiers = [Str::random()]),
|
||||
(new Component)->stateBindingModifiers($modifiers = [Str::random()]),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ test('container has state path', function () {
|
||||
test('container has state path and inherits state path from parent component', function () {
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->parentComponent(
|
||||
(new Component())
|
||||
(new Component)
|
||||
->container(ComponentContainer::make(Livewire::make()))
|
||||
->statePath($parentComponentStatePath = Str::random()),
|
||||
)
|
||||
@@ -32,7 +32,7 @@ test('container has state path and inherits state path from parent component', f
|
||||
});
|
||||
|
||||
test('component has state path', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(ComponentContainer::make(Livewire::make()))
|
||||
->statePath($componentStatePath = Str::random());
|
||||
|
||||
@@ -41,7 +41,7 @@ test('component has state path', function () {
|
||||
});
|
||||
|
||||
test('component inherits state path from container', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(
|
||||
ComponentContainer::make(Livewire::make())
|
||||
->statePath($containerStatePath = Str::random()),
|
||||
@@ -52,7 +52,7 @@ test('component inherits state path from container', function () {
|
||||
});
|
||||
|
||||
test('component has state path and inherits state path from container', function () {
|
||||
$component = (new Component())
|
||||
$component = (new Component)
|
||||
->container(
|
||||
ComponentContainer::make(Livewire::make())
|
||||
->statePath($containerStatePath = Str::random()),
|
||||
@@ -67,7 +67,7 @@ test('state can be hydrated from array', function () {
|
||||
ComponentContainer::make($livewire = Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random()),
|
||||
])
|
||||
->fill([$statePath => ($state = Str::random())]);
|
||||
@@ -87,7 +87,7 @@ test('hydrating array state can overwrite existing state', function () {
|
||||
)
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath),
|
||||
])
|
||||
->fill([]);
|
||||
@@ -100,7 +100,7 @@ test('state can be hydrated from defaults', function () {
|
||||
ComponentContainer::make($livewire = Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->default($state = Str::random()),
|
||||
])
|
||||
@@ -121,7 +121,7 @@ test('hydrating default state can overwrite existing state', function () {
|
||||
)
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath),
|
||||
])
|
||||
->fill();
|
||||
@@ -134,10 +134,10 @@ test('child component state is not lost by hydrating parent component', function
|
||||
ComponentContainer::make($livewire = Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($parentStatePath = Str::random())
|
||||
->schema([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->default($state = Str::random()),
|
||||
]),
|
||||
@@ -152,10 +152,10 @@ test('child component state is not lost by hydrating parent component defaults',
|
||||
ComponentContainer::make($livewire = Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($parentStatePath = Str::random())
|
||||
->schema([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->default($state = Str::random()),
|
||||
])
|
||||
@@ -171,10 +171,10 @@ test('child component state can be hydrated by parent component defaults', funct
|
||||
ComponentContainer::make($livewire = Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($parentStatePath = Str::random())
|
||||
->schema([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random()),
|
||||
])
|
||||
->default([$statePath => ($state = Str::random())]),
|
||||
@@ -189,10 +189,10 @@ test('child component defaults are overwritten by parent component defaults', fu
|
||||
ComponentContainer::make($livewire = Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($parentStatePath = Str::random())
|
||||
->schema([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->default(Str::random()),
|
||||
])
|
||||
@@ -208,10 +208,10 @@ test('missing child component state can be filled with null', function () {
|
||||
ComponentContainer::make($livewire = Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($parentStatePath = Str::random())
|
||||
->schema([
|
||||
(new Component())->statePath($statePath = Str::random()),
|
||||
(new Component)->statePath($statePath = Str::random()),
|
||||
])
|
||||
->afterStateHydrated(fn (Component $component) => $component->state([])),
|
||||
])
|
||||
@@ -225,10 +225,10 @@ test('missing hidden child component state can be filled with null', function ()
|
||||
ComponentContainer::make($livewire = Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->hidden()
|
||||
->schema([
|
||||
(new Component())->statePath($statePath = Str::random()),
|
||||
(new Component)->statePath($statePath = Str::random()),
|
||||
]),
|
||||
])
|
||||
->fill();
|
||||
@@ -241,7 +241,7 @@ test('custom logic can be executed after state is hydrated', function () {
|
||||
ComponentContainer::make($livewire = Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->afterStateHydrated(fn (Component $component, $state) => $component->state(strrev($state))),
|
||||
])
|
||||
@@ -255,7 +255,7 @@ test('custom logic can be executed after state is updated', function () {
|
||||
ComponentContainer::make($livewire = Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->afterStateUpdated(fn (Component $component, $state) => $component->state(strrev($state))),
|
||||
])
|
||||
@@ -270,7 +270,7 @@ test('custom logic can be executed after nested state is updated', function () {
|
||||
ComponentContainer::make($livewire = Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->afterStateUpdated(fn (Component $component, $state) => $component->state([strrev($state[0])])),
|
||||
])
|
||||
@@ -285,10 +285,10 @@ test('custom logic can be executed after child component state is updated', func
|
||||
ComponentContainer::make($livewire = Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->childComponents([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($childComponentStatePath = Str::random())
|
||||
->afterStateUpdated(fn (Component $component, $state) => $component->state(strrev($state))),
|
||||
]),
|
||||
@@ -306,7 +306,7 @@ test('custom logic can be executed only once after nested state is updated', fun
|
||||
ComponentContainer::make($livewire = Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->afterStateUpdated(function () use (&$calls) {
|
||||
$calls++;
|
||||
@@ -322,7 +322,7 @@ test('custom logic can be executed more than once after nested state is updated
|
||||
ComponentContainer::make($livewire = Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->afterStateUpdated(fn (Component $component, $state) => $component->state([$state[0] + 1])),
|
||||
])
|
||||
@@ -338,10 +338,10 @@ test('custom logic on parent component can be executed after child component sta
|
||||
ComponentContainer::make($livewire = Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->childComponents([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($childComponentStatePath = Str::random()),
|
||||
])
|
||||
->afterStateUpdated(fn (Component $component, $state) => $component->state([
|
||||
@@ -359,7 +359,7 @@ test('state can be dehydrated', function () {
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->default($state = Str::random()),
|
||||
])
|
||||
@@ -375,7 +375,7 @@ test('state can be dehydrated using custom logic', function () {
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->default($state = Str::random())
|
||||
->dehydrateStateUsing(fn ($state) => strrev($state)),
|
||||
@@ -392,7 +392,7 @@ test('custom logic can be executed before state is dehydrated', function () {
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->default($state = Str::random())
|
||||
->beforeStateDehydrated(fn (Component $component, $state) => $component->state(strrev($state))),
|
||||
@@ -411,7 +411,7 @@ test('components can be excluded from state dehydration', function () {
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath(Str::random())
|
||||
->default(Str::random())
|
||||
->dehydrated(false),
|
||||
@@ -426,10 +426,10 @@ test('components can be excluded from state dehydration if their parent componen
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->dehydrated(false)
|
||||
->schema([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath(Str::random())
|
||||
->default(Str::random()),
|
||||
]),
|
||||
@@ -444,7 +444,7 @@ test('hidden components are excluded from state dehydration', function () {
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath(Str::random())
|
||||
->default(Str::random())
|
||||
->hidden(),
|
||||
@@ -459,10 +459,10 @@ test('hidden components are excluded from state dehydration if their parent comp
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->hidden()
|
||||
->schema([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath(Str::random())
|
||||
->default(Str::random()),
|
||||
]),
|
||||
@@ -477,7 +477,7 @@ test('hidden components are excluded from state dehydration except if they are m
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath(Str::random())
|
||||
->default(Str::random())
|
||||
->hidden()
|
||||
@@ -493,7 +493,7 @@ test('disabled components are excluded from state dehydration', function () {
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath(Str::random())
|
||||
->default(Str::random())
|
||||
->disabled(),
|
||||
@@ -508,10 +508,10 @@ test('disabled components are excluded from state dehydration if their parent co
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->disabled()
|
||||
->schema([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath(Str::random())
|
||||
->default(Str::random()),
|
||||
]),
|
||||
@@ -526,7 +526,7 @@ test('disabled components are excluded from state dehydration except if they are
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath(Str::random())
|
||||
->default(Str::random())
|
||||
->disabled()
|
||||
@@ -542,10 +542,10 @@ test('disabled components are excluded from state dehydration if their parent co
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->disabled()
|
||||
->schema([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath(Str::random())
|
||||
->default(Str::random())
|
||||
->dehydrated(),
|
||||
@@ -561,7 +561,7 @@ test('dehydrated state can be mutated', function () {
|
||||
$container = ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->default($state = Str::random())
|
||||
->mutateDehydratedStateUsing(fn ($state) => strrev($state)),
|
||||
@@ -580,7 +580,7 @@ test('sibling state can be retrieved relatively from another component', functio
|
||||
ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->default($state = Str::random()),
|
||||
$placeholder = Placeholder::make(Str::random())
|
||||
@@ -596,10 +596,10 @@ test('sibling nested state can be retrieved relatively from another component',
|
||||
ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($parentStatePath = Str::random())
|
||||
->schema([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->default($state = Str::random()),
|
||||
]),
|
||||
@@ -616,10 +616,10 @@ test('parent sibling state can be retrieved relatively from another component',
|
||||
ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->default($state = Str::random()),
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath(Str::random())
|
||||
->schema([
|
||||
$placeholder = Placeholder::make(Str::random())
|
||||
@@ -636,7 +636,7 @@ test('sibling state can be retrieved absolutely from another component', functio
|
||||
ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->default($state = Str::random()),
|
||||
$placeholder = Placeholder::make(Str::random())
|
||||
@@ -652,10 +652,10 @@ test('sibling nested state can be retrieved absolutely from another component',
|
||||
ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($parentStatePath = Str::random())
|
||||
->schema([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->default($state = Str::random()),
|
||||
]),
|
||||
@@ -672,10 +672,10 @@ test('parent sibling state can be retrieved absolutely from another component',
|
||||
ComponentContainer::make(Livewire::make())
|
||||
->statePath('data')
|
||||
->components([
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath($statePath = Str::random())
|
||||
->default($state = Str::random()),
|
||||
(new Component())
|
||||
(new Component)
|
||||
->statePath(Str::random())
|
||||
->schema([
|
||||
$placeholder = Placeholder::make(Str::random())
|
||||
|
||||
@@ -174,7 +174,7 @@ it('can close notifications', function () {
|
||||
|
||||
function getLastNotificationAction()
|
||||
{
|
||||
$notificationsLivewireComponent = new Notifications();
|
||||
$notificationsLivewireComponent = new Notifications;
|
||||
$notificationsLivewireComponent->mount();
|
||||
$notifications = $notificationsLivewireComponent->notifications;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ it('can log a user out', function () {
|
||||
});
|
||||
|
||||
it('allows a user to override the logout response', function () {
|
||||
$logoutResponseFake = new class() implements LogoutResponse
|
||||
$logoutResponseFake = new class implements LogoutResponse
|
||||
{
|
||||
public function toResponse($request): RedirectResponse
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user