Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Laravel 11 & PHP 8.2 #381

Merged
merged 4 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions .github/workflows/laravel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
22 changes: 12 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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."
Expand All @@ -40,7 +39,10 @@
"Studio\\Totem\\": "src/",
"Studio\\Totem\\Tests\\": "tests/",
"Database\\Factories\\": "database/factories/"
}
},
"files": [
"src/helpers.php"
]
},
"extra": {
"component": "package",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
29 changes: 17 additions & 12 deletions resources/views/tasks/index.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,24 +6,29 @@
@section('title')
<div class="uk-flex uk-flex-between uk-flex-middle">
<h4 class="uk-card-title uk-margin-remove">Tasks</h4>
{!! Form::open([
'id' => 'totem__search__form',
'url' => Request::fullUrl(),
'method' => 'GET',
'class' => 'uk-display-inline uk-search uk-search-default'
]) !!}
<span uk-search-icon></span>
{!! Form::text('q', request('q'), ['class' => 'uk-search-input', 'placeholder' => 'Search...']) !!}
{!! Form::close() !!}
<form
accept-charset="UTF-8"
method="GET"
action="{{ request()->fullUrl() }}"
id="totem__search__form"
class="uk-display-inline uk-search uk-search-default">
<span uk-search-icon></span>
<input
value="{{ request('q') }}"
placeholder="Search..."
name="q"
type="text"
class="uk-search-input">
</form>
</div>
@stop
@section('main-panel-content')
<table class="uk-table uk-table-responsive" cellpadding="0" cellspacing="0" class="mb1">
<thead>
<tr>
<th>{!! Html::columnSort('Description', 'description') !!}</th>
<th>{!! Html::columnSort('Average Runtime', 'average_runtime') !!}</th>
<th>{!! Html::columnSort('Last Run', 'last_ran_at') !!}</th>
<th>{!! \Studio\Totem\Helpers\columnSort('Description', 'description') !!}</th>
<th>{!! \Studio\Totem\Helpers\columnSort('Average Runtime', 'average_runtime') !!}</th>
<th>{!! \Studio\Totem\Helpers\columnSort('Last Run', 'last_ran_at') !!}</th>
<th>Next Run</th>
<th class="uk-text-center">Execute</th>
</tr>
Expand Down
55 changes: 0 additions & 55 deletions src/Providers/TotemFormServiceProvider.php

This file was deleted.

1 change: 0 additions & 1 deletion src/Providers/TotemServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
45 changes: 45 additions & 0 deletions src/helpers.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

namespace Studio\Totem\Helpers;

use Illuminate\Support\HtmlString;

function columnSort(string $label, string $columnKey, bool $isDefault = false)
{
$icon = '';

if (request()->has('sort_by')) {
if (request()->input('sort_by') == $columnKey) {
$icon = ' <span class="fa fa-caret-'
.(request()->input('sort_direction', 'asc') == 'asc' ? 'up' : 'down')
.'"></span>';
}
} elseif ($isDefault) {
$icon = ' <span class="fa fa-caret-'
.(request()->input('sort_direction', 'asc') == 'asc' ? 'up' : 'down')
.'"></span>';
}

$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(
'<a href="'
.$url
.'">'
.$label
.$icon
.'</a>'
);
}
16 changes: 2 additions & 14 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
];
}

Expand Down
Loading