Skip to content

Commit d13a371

Browse files
authored
adds laravel 11.x and php 8.x support
1 parent e98011d commit d13a371

File tree

8 files changed

+84
-95
lines changed

8 files changed

+84
-95
lines changed

.github/workflows/laravel.yml

+7-2
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,17 @@ jobs:
99
fail-fast: true
1010
matrix:
1111
os: [ ubuntu-latest ]
12-
php: [ 8.1 ]
13-
laravel: [ 10.* ]
12+
php: [ 8.1, 8.2 ]
13+
laravel: [ 10.*, 11.* ]
1414
stability: [ prefer-stable ]
1515
include:
1616
- laravel: 10.*
1717
testbench: ^8.0
18+
- laravel: 11.*
19+
testbench: ^9.0
20+
exclude:
21+
- laravel: 11.*
22+
php: 8.1
1823
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
1924

2025
steps:

composer.json

+12-10
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,17 @@
1919
"php": "^8.1.0",
2020
"ext-json": "*",
2121
"doctrine/dbal": "^3.1",
22-
"illuminate/bus": "^9.0|^10.0",
23-
"illuminate/console": "^9.0|^10.0",
24-
"illuminate/contracts": "^9.0|^10.0",
25-
"illuminate/database": "^9.0|^10.0",
26-
"illuminate/events": "^9.0|^10.0",
27-
"illuminate/notifications": "^9.0|^10.0",
28-
"laravelcollective/html": "^6.0"
22+
"illuminate/bus": "^9.0|^10.0|^11.0",
23+
"illuminate/console": "^9.0|^10.0|^11.0",
24+
"illuminate/contracts": "^9.0|^10.0|^11.0",
25+
"illuminate/database": "^9.0|^10.0|^11.0",
26+
"illuminate/events": "^9.0|^10.0|^11.0",
27+
"illuminate/notifications": "^9.0|^10.0|^11.0"
2928
},
3029
"require-dev": {
3130
"mockery/mockery": "^1.0",
32-
"orchestra/testbench" : "^8.0",
33-
"phpunit/phpunit": "^9.0"
31+
"orchestra/testbench" : "^8.0|^9.0",
32+
"phpunit/phpunit": "^9.0|^10.0|^11.0"
3433
},
3534
"suggest": {
3635
"nexmo/client": "Required for sms notifications."
@@ -40,7 +39,10 @@
4039
"Studio\\Totem\\": "src/",
4140
"Studio\\Totem\\Tests\\": "tests/",
4241
"Database\\Factories\\": "database/factories/"
43-
}
42+
},
43+
"files": [
44+
"src/helpers.php"
45+
]
4446
},
4547
"extra": {
4648
"component": "package",

database/migrations/2019_09_25_103421_update_task_results_duration_type.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ private function migrateDurationValues(bool $toFloat = true)
5555
->chunkById(100, function ($rows) use ($toFloat) {
5656
foreach ($rows as $row) {
5757
DB::connection(TOTEM_DATABASE_CONNECTION)
58-
->table(TOTEM_TABLE_PREFIX)
58+
->table(TOTEM_TABLE_PREFIX.'task_results')
5959
->where('id', $row->id)
6060
->update([
6161
'duration' => $toFloat ? floatval($row->duration_old) : (string) $row->duration_old,

resources/views/tasks/index.blade.php

+17-12
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,29 @@
66
@section('title')
77
<div class="uk-flex uk-flex-between uk-flex-middle">
88
<h4 class="uk-card-title uk-margin-remove">Tasks</h4>
9-
{!! Form::open([
10-
'id' => 'totem__search__form',
11-
'url' => Request::fullUrl(),
12-
'method' => 'GET',
13-
'class' => 'uk-display-inline uk-search uk-search-default'
14-
]) !!}
15-
<span uk-search-icon></span>
16-
{!! Form::text('q', request('q'), ['class' => 'uk-search-input', 'placeholder' => 'Search...']) !!}
17-
{!! Form::close() !!}
9+
<form
10+
accept-charset="UTF-8"
11+
method="GET"
12+
action="{{ request()->fullUrl() }}"
13+
id="totem__search__form"
14+
class="uk-display-inline uk-search uk-search-default">
15+
<span uk-search-icon></span>
16+
<input
17+
value="{{ request('q') }}"
18+
placeholder="Search..."
19+
name="q"
20+
type="text"
21+
class="uk-search-input">
22+
</form>
1823
</div>
1924
@stop
2025
@section('main-panel-content')
2126
<table class="uk-table uk-table-responsive" cellpadding="0" cellspacing="0" class="mb1">
2227
<thead>
2328
<tr>
24-
<th>{!! Html::columnSort('Description', 'description') !!}</th>
25-
<th>{!! Html::columnSort('Average Runtime', 'average_runtime') !!}</th>
26-
<th>{!! Html::columnSort('Last Run', 'last_ran_at') !!}</th>
29+
<th>{!! \Studio\Totem\Helpers\columnSort('Description', 'description') !!}</th>
30+
<th>{!! \Studio\Totem\Helpers\columnSort('Average Runtime', 'average_runtime') !!}</th>
31+
<th>{!! \Studio\Totem\Helpers\columnSort('Last Run', 'last_ran_at') !!}</th>
2732
<th>Next Run</th>
2833
<th class="uk-text-center">Execute</th>
2934
</tr>

src/Providers/TotemFormServiceProvider.php

-55
This file was deleted.

src/Providers/TotemServiceProvider.php

-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ public function register()
6565
$this->app->alias('totem.tasks', TaskInterface::class);
6666
$this->app->register(TotemRouteServiceProvider::class);
6767
$this->app->register(TotemEventServiceProvider::class);
68-
$this->app->register(TotemFormServiceProvider::class);
6968
$this->app->register(ConsoleServiceProvider::class);
7069
}
7170

src/helpers.php

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<?php
2+
3+
namespace Studio\Totem\Helpers;
4+
5+
use Illuminate\Support\HtmlString;
6+
7+
function columnSort(string $label, string $columnKey, bool $isDefault = false)
8+
{
9+
$icon = '';
10+
11+
if (request()->has('sort_by')) {
12+
if (request()->input('sort_by') == $columnKey) {
13+
$icon = ' <span class="fa fa-caret-'
14+
.(request()->input('sort_direction', 'asc') == 'asc' ? 'up' : 'down')
15+
.'"></span>';
16+
}
17+
} elseif ($isDefault) {
18+
$icon = ' <span class="fa fa-caret-'
19+
.(request()->input('sort_direction', 'asc') == 'asc' ? 'up' : 'down')
20+
.'"></span>';
21+
}
22+
23+
$order = 'asc';
24+
if (request()->has('sort_direction')) {
25+
$order = (request()->input('sort_direction') == 'desc' ? 'asc' : 'desc');
26+
} elseif ($isDefault) {
27+
$order = 'desc';
28+
}
29+
30+
$url = request()->fullUrlWithQuery([
31+
'sort_by' => $columnKey,
32+
'sort_direction' => $order,
33+
'filter' => request('filter'),
34+
'limit' => request('limit'),
35+
]);
36+
37+
return new HtmlString(
38+
'<a href="'
39+
.$url
40+
.'">'
41+
.$label
42+
.$icon
43+
.'</a>'
44+
);
45+
}

tests/TestCase.php

+2-14
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22

33
namespace Studio\Totem\Tests;
44

5-
use Collective\Html\FormFacade;
6-
use Collective\Html\HtmlFacade;
7-
use Collective\Html\HtmlServiceProvider;
85
use Illuminate\Contracts\Debug\ExceptionHandler;
96
use Illuminate\Support\Facades\Auth;
107
use Orchestra\Testbench\Exceptions\Handler;
@@ -47,25 +44,16 @@ protected function getEnvironmentSetUp($app)
4744
{
4845
$app['config']->set('database.default', 'testing');
4946
$app['config']->set('database.connections.testing', [
50-
'driver' => 'sqlite',
47+
'driver' => 'sqlite',
5148
'database' => ':memory:',
52-
'prefix' => '',
49+
'prefix' => '',
5350
]);
5451
}
5552

56-
protected function getPackageAliases($app)
57-
{
58-
return [
59-
'Form' => FormFacade::class,
60-
'Html' => HtmlFacade::class,
61-
];
62-
}
63-
6453
protected function getPackageProviders($app)
6554
{
6655
return [
6756
TotemServiceProvider::class,
68-
HtmlServiceProvider::class,
6957
];
7058
}
7159

0 commit comments

Comments
 (0)