diff --git a/.github/workflows/laravel.yml b/.github/workflows/laravel.yml index a6c6bdb1..679f036f 100644 --- a/.github/workflows/laravel.yml +++ b/.github/workflows/laravel.yml @@ -9,12 +9,17 @@ jobs: fail-fast: true matrix: os: [ ubuntu-latest ] - php: [ 8.1 ] - laravel: [ 10.* ] + php: [ 8.1, 8.2 ] + laravel: [ 10.*, 11.* ] stability: [ prefer-stable ] include: - laravel: 10.* testbench: ^8.0 + - laravel: 11.* + testbench: ^9.0 + exclude: + - laravel: 11.* + php: 8.1 name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }} steps: diff --git a/composer.json b/composer.json index aa1eec17..2ae22ad8 100644 --- a/composer.json +++ b/composer.json @@ -19,18 +19,17 @@ "php": "^8.1.0", "ext-json": "*", "doctrine/dbal": "^3.1", - "illuminate/bus": "^9.0|^10.0", - "illuminate/console": "^9.0|^10.0", - "illuminate/contracts": "^9.0|^10.0", - "illuminate/database": "^9.0|^10.0", - "illuminate/events": "^9.0|^10.0", - "illuminate/notifications": "^9.0|^10.0", - "laravelcollective/html": "^6.0" + "illuminate/bus": "^9.0|^10.0|^11.0", + "illuminate/console": "^9.0|^10.0|^11.0", + "illuminate/contracts": "^9.0|^10.0|^11.0", + "illuminate/database": "^9.0|^10.0|^11.0", + "illuminate/events": "^9.0|^10.0|^11.0", + "illuminate/notifications": "^9.0|^10.0|^11.0" }, "require-dev": { "mockery/mockery": "^1.0", - "orchestra/testbench" : "^8.0", - "phpunit/phpunit": "^9.0" + "orchestra/testbench" : "^8.0|^9.0", + "phpunit/phpunit": "^9.0|^10.0|^11.0" }, "suggest": { "nexmo/client": "Required for sms notifications." @@ -40,7 +39,10 @@ "Studio\\Totem\\": "src/", "Studio\\Totem\\Tests\\": "tests/", "Database\\Factories\\": "database/factories/" - } + }, + "files": [ + "src/helpers.php" + ] }, "extra": { "component": "package", diff --git a/database/migrations/2019_09_25_103421_update_task_results_duration_type.php b/database/migrations/2019_09_25_103421_update_task_results_duration_type.php index 0c91404a..b92365f6 100644 --- a/database/migrations/2019_09_25_103421_update_task_results_duration_type.php +++ b/database/migrations/2019_09_25_103421_update_task_results_duration_type.php @@ -55,7 +55,7 @@ private function migrateDurationValues(bool $toFloat = true) ->chunkById(100, function ($rows) use ($toFloat) { foreach ($rows as $row) { DB::connection(TOTEM_DATABASE_CONNECTION) - ->table(TOTEM_TABLE_PREFIX) + ->table(TOTEM_TABLE_PREFIX.'task_results') ->where('id', $row->id) ->update([ 'duration' => $toFloat ? floatval($row->duration_old) : (string) $row->duration_old, diff --git a/resources/views/tasks/index.blade.php b/resources/views/tasks/index.blade.php index 12f80327..cd34ff8d 100644 --- a/resources/views/tasks/index.blade.php +++ b/resources/views/tasks/index.blade.php @@ -6,24 +6,29 @@ @section('title')

Tasks

- {!! Form::open([ - 'id' => 'totem__search__form', - 'url' => Request::fullUrl(), - 'method' => 'GET', - 'class' => 'uk-display-inline uk-search uk-search-default' - ]) !!} - - {!! Form::text('q', request('q'), ['class' => 'uk-search-input', 'placeholder' => 'Search...']) !!} - {!! Form::close() !!} +
@stop @section('main-panel-content') - - - + + + diff --git a/src/Providers/TotemFormServiceProvider.php b/src/Providers/TotemFormServiceProvider.php deleted file mode 100644 index c20095c4..00000000 --- a/src/Providers/TotemFormServiceProvider.php +++ /dev/null @@ -1,55 +0,0 @@ -app['html']->macro('columnSort', function (string $label, string $columnKey, bool $isDefault = false) { - $icon = ''; - - if (request()->has('sort_by')) { - if (request()->input('sort_by') == $columnKey) { - $icon = ' '; - } - } elseif ($isDefault) { - $icon = ' '; - } - - $order = 'asc'; - if (request()->has('sort_direction')) { - $order = (request()->input('sort_direction') == 'desc' ? 'asc' : 'desc'); - } elseif ($isDefault) { - $order = 'desc'; - } - - $url = request()->fullUrlWithQuery([ - 'sort_by' => $columnKey, - 'sort_direction' => $order, - 'filter' => request('filter'), - 'limit' => request('limit'), - ]); - - return app('html')->toHtmlString( - '' - .$label - .$icon - .'' - ); - }); - } -} diff --git a/src/Providers/TotemServiceProvider.php b/src/Providers/TotemServiceProvider.php index 87bceac6..f3139c78 100644 --- a/src/Providers/TotemServiceProvider.php +++ b/src/Providers/TotemServiceProvider.php @@ -65,7 +65,6 @@ public function register() $this->app->alias('totem.tasks', TaskInterface::class); $this->app->register(TotemRouteServiceProvider::class); $this->app->register(TotemEventServiceProvider::class); - $this->app->register(TotemFormServiceProvider::class); $this->app->register(ConsoleServiceProvider::class); } diff --git a/src/helpers.php b/src/helpers.php new file mode 100644 index 00000000..6d7e2e0f --- /dev/null +++ b/src/helpers.php @@ -0,0 +1,45 @@ +has('sort_by')) { + if (request()->input('sort_by') == $columnKey) { + $icon = ' '; + } + } elseif ($isDefault) { + $icon = ' '; + } + + $order = 'asc'; + if (request()->has('sort_direction')) { + $order = (request()->input('sort_direction') == 'desc' ? 'asc' : 'desc'); + } elseif ($isDefault) { + $order = 'desc'; + } + + $url = request()->fullUrlWithQuery([ + 'sort_by' => $columnKey, + 'sort_direction' => $order, + 'filter' => request('filter'), + 'limit' => request('limit'), + ]); + + return new HtmlString( + '' + .$label + .$icon + .'' + ); +} diff --git a/tests/TestCase.php b/tests/TestCase.php index 1ea0acf2..2700020a 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,9 +2,6 @@ namespace Studio\Totem\Tests; -use Collective\Html\FormFacade; -use Collective\Html\HtmlFacade; -use Collective\Html\HtmlServiceProvider; use Illuminate\Contracts\Debug\ExceptionHandler; use Illuminate\Support\Facades\Auth; use Orchestra\Testbench\Exceptions\Handler; @@ -47,25 +44,16 @@ protected function getEnvironmentSetUp($app) { $app['config']->set('database.default', 'testing'); $app['config']->set('database.connections.testing', [ - 'driver' => 'sqlite', + 'driver' => 'sqlite', 'database' => ':memory:', - 'prefix' => '', + 'prefix' => '', ]); } - protected function getPackageAliases($app) - { - return [ - 'Form' => FormFacade::class, - 'Html' => HtmlFacade::class, - ]; - } - protected function getPackageProviders($app) { return [ TotemServiceProvider::class, - HtmlServiceProvider::class, ]; }
{!! Html::columnSort('Description', 'description') !!}{!! Html::columnSort('Average Runtime', 'average_runtime') !!}{!! Html::columnSort('Last Run', 'last_ran_at') !!}{!! \Studio\Totem\Helpers\columnSort('Description', 'description') !!}{!! \Studio\Totem\Helpers\columnSort('Average Runtime', 'average_runtime') !!}{!! \Studio\Totem\Helpers\columnSort('Last Run', 'last_ran_at') !!} Next Run Execute