Skip to content

Commit

Permalink
fix stan issues
Browse files Browse the repository at this point in the history
  • Loading branch information
phpsa committed Feb 11, 2024
1 parent 7327a27 commit 4dee695
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 19 deletions.
2 changes: 1 addition & 1 deletion .phpunit.cache/test-results
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"version":1,"defects":{"CustomD\\LaravelHelpers\\Tests\\DateHandlingTest::testDatesBasedOnUserAndSystemTimezone":7,"CustomD\\LaravelHelpers\\Tests\\DateHandlingTest::testMultipleCarbonInstances":8,"CustomD\\LaravelHelpers\\Tests\\DateHandlingTest::testSetsViaMiddleware":8,"CustomD\\LaravelHelpers\\Tests\\DateHandlingTest::testSetsViaMiddlewareWithHeader":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_where_null_or_empty":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_or_where_null_or_empty":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_where_not_null_or_empty":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_or_where_not_null_or_empty":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_has_one_nullable":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_has_one_not_nullable":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_belongs_to_nullable":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_belongs_to_not_nullable":8,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithNoArgs":8,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithOneArg":8,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithOneArgAsArray":8,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithMultipleArgs":8,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithArrayAsArgs":8,"CustomD\\LaravelHelpers\\Tests\\StringMacrosTest::testReverseStringMacro":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_case_insensitive_iwhere":7},"times":{"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_where_null_or_empty":0.027,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_or_where_null_or_empty":0.002,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_where_not_null_or_empty":0.002,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_or_where_not_null_or_empty":0.002,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_has_one_nullable":0.012,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_has_one_not_nullable":0.005,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_belongs_to_nullable":0.003,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_belongs_to_not_nullable":0.002,"CustomD\\LaravelHelpers\\Tests\\DateHandlingTest::testDatesBasedOnUserAndSystemTimezone":0.015,"CustomD\\LaravelHelpers\\Tests\\DateHandlingTest::testSetsViaMiddleware":0.001,"CustomD\\LaravelHelpers\\Tests\\DateHandlingTest::testSetsViaMiddlewareWithHeader":0,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithNoArgs":0.007,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithOneArg":0,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithOneArgAsArray":0,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithMultipleArgs":0,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithArrayAsArgs":0,"CustomD\\LaravelHelpers\\Tests\\StringMacrosTest::testReverseStringMacro":0,"CustomD\\LaravelHelpers\\Tests\\DateHandlingTest::testMultipleCarbonInstances":0,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_case_insensitive_iwhere":0.002}}
{"version":1,"defects":{"CustomD\\LaravelHelpers\\Tests\\DateHandlingTest::testDatesBasedOnUserAndSystemTimezone":7,"CustomD\\LaravelHelpers\\Tests\\DateHandlingTest::testMultipleCarbonInstances":8,"CustomD\\LaravelHelpers\\Tests\\DateHandlingTest::testSetsViaMiddleware":8,"CustomD\\LaravelHelpers\\Tests\\DateHandlingTest::testSetsViaMiddlewareWithHeader":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_where_null_or_empty":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_or_where_null_or_empty":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_where_not_null_or_empty":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_or_where_not_null_or_empty":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_has_one_nullable":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_has_one_not_nullable":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_belongs_to_nullable":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_belongs_to_not_nullable":8,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithNoArgs":8,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithOneArg":8,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithOneArgAsArray":8,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithMultipleArgs":8,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithArrayAsArgs":8,"CustomD\\LaravelHelpers\\Tests\\StringMacrosTest::testReverseStringMacro":8,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_case_insensitive_iwhere":7},"times":{"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_where_null_or_empty":0.039,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_or_where_null_or_empty":0.003,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_where_not_null_or_empty":0.003,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_or_where_not_null_or_empty":0.003,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_has_one_nullable":0.015,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_has_one_not_nullable":0.008,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_belongs_to_nullable":0.006,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_belongs_to_not_nullable":0.004,"CustomD\\LaravelHelpers\\Tests\\DateHandlingTest::testDatesBasedOnUserAndSystemTimezone":0.024,"CustomD\\LaravelHelpers\\Tests\\DateHandlingTest::testSetsViaMiddleware":0.001,"CustomD\\LaravelHelpers\\Tests\\DateHandlingTest::testSetsViaMiddlewareWithHeader":0,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithNoArgs":0.012,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithOneArg":0,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithOneArgAsArray":0,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithMultipleArgs":0,"CustomD\\LaravelHelpers\\Tests\\LaravelHelpersTest::testExecuteHelperCallsActionWithArrayAsArgs":0,"CustomD\\LaravelHelpers\\Tests\\StringMacrosTest::testReverseStringMacro":0,"CustomD\\LaravelHelpers\\Tests\\DateHandlingTest::testMultipleCarbonInstances":0,"CustomD\\LaravelHelpers\\Tests\\DatabaseMacrosTest::test_case_insensitive_iwhere":0.004,"CustomD\\LaravelHelpers\\Tests\\ValueObjectTest::test_it_can_create_a_value_object":0.031,"CustomD\\LaravelHelpers\\Tests\\ValueObjectTest::test_it_can_create_a_value_object_from_request":0,"CustomD\\LaravelHelpers\\Tests\\ValueObjectTest::test_it_validates_when_constructed":0.004,"CustomD\\LaravelHelpers\\Tests\\ValueObjectTest::test_it_can_be_passed_an_array":0,"CustomD\\LaravelHelpers\\Tests\\ValueObjectTest::test_a_complex_value":0.001,"CustomD\\LaravelHelpers\\Tests\\ValueObjectTest::test_a_complex_value_construct":0}}
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
"illuminate/support": "^9.0|^10|^11.0"
},
"require-dev": {
"orchestra/testbench": "^7.0|^8.0|^9.0",
"filament/filament": "^3.2",
"nunomaduro/larastan": "^1.0|^2.0",
"orchestra/testbench": "^7.0|^8.0|^9.0",
"phpunit/phpunit": "^9.0|^10.0"
},
"autoload": {
Expand Down
40 changes: 23 additions & 17 deletions src/Filament/Plugins/UserTimeZonePlugin.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<?php

namespace CustomD\LaravelHelpers\Filament\Plugins;


use Filament\Panel;
use Livewire\Livewire;
use Filament\Contracts\Plugin;
use Filament\Tables\Columns\TextColumn;
use Filament\Forms\Components\DatePicker;
use Filament\Infolists\Components\TextEntry;
use Filament\Forms\Components\DateTimePicker;
use CustomD\LaravelHelpers\Http\Middleware\UserTimeZone;
use Illuminate\Contracts\Support\Htmlable;
use Illuminate\Support\HtmlString;

class UserTimeZonePlugin implements Plugin
{
public static function make(): static
public static function make(): self
{
return new static();
return new self();
}

public function getId(): string
Expand All @@ -37,18 +36,25 @@ public function register(Panel $panel): void

public function boot(Panel $panel): void
{
DateTimePicker::configureUsing(function (DateTimePicker $dateTimePicker): void {
$dateTimePicker->timezone(config('request.user.timezone'));
$dateTimePicker->helperText(fn(DateTimePicker $component) => str("Using the **_{$component->getTimezone()}_** timezone")->markdown()->toHtmlString());
});

TextColumn::configureUsing(function (TextColumn $textColumn): void {
$textColumn->timezone(config('request.user.timezone'));
});

TextEntry::configureUsing(function (TextEntry $textEntry): void {
$textEntry->timezone(config('request.user.timezone'));
});

$timezone = config('request.user.timezone') ?? config('app.timezone') ?? 'UTC';
if (is_string($timezone) === false || blank($timezone)) {
$timezone = 'UTC';
}

DateTimePicker::configureUsing(
fn (DateTimePicker $dateTimePicker): DateTimePicker => $dateTimePicker->timezone($timezone)
->helperText(
fn(DateTimePicker $component): Htmlable => new HtmlString("Using the <b><i>{$component->getTimezone()}</i></b> timezone")
)
);

TextColumn::configureUsing(
fn (TextColumn $textColumn): TextColumn => $textColumn->timezone($timezone)
);

TextEntry::configureUsing(
fn(TextEntry $textEntry): TextEntry => $textEntry->timezone($timezone)
);
}
}

0 comments on commit 4dee695

Please sign in to comment.