Skip to content

Commit dd0aa0d

Browse files
qschmickclaude
andauthored
Modernize: PHP 8.2+ patterns, Vue 3, Vite 6, Vonage, remove deprecated APIs (#409)
* refactor: replace global PHP constants with config() calls Remove TOTEM_PATH, TOTEM_TABLE_PREFIX, and TOTEM_DATABASE_CONNECTION global constants from TotemServiceProvider::register(). Replace all usages throughout src/ and database/migrations/ with config() calls and $this->prefix()/$this->getConnection() helpers on TotemMigration. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: address code review issues in global constants removal Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: replace deprecated CronExpression::factory() with new CronExpression() Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: add CronExpression validation rule class * feat: add JsonFile validation rule class * Strengthen JsonFile rule test assertion Assert message content matches 'JSON file' rather than just asserting it is non-null, consistent with CronExpression rule test pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: replace Validator::extend() with ValidationRule classes Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * feat: replace deprecated Nexmo channel with Vonage Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: remove RouteServiceProvider, inline routes with tuple syntax Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: use configured cache store in route bind, eager load frequencies Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: merge ConsoleServiceProvider into TotemServiceProvider Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: update TaskExecutionTest to use TotemServiceProvider after ConsoleServiceProvider merge Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: remove request() from HasFrequencies model trait Move frequency persistence logic out of the Eloquent model lifecycle hook and into the repository layer where HTTP context is already available. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: remove request() from HasParameters trait, explicit afterSave passing Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: move User model to tests, fix helpers.php icon dependency, add return types Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: move test fixtures to autoload-dev, factory to tests/ Move Studio\Totem\Tests namespace from autoload to autoload-dev. Move TotemUserFactory from database/factories/ to tests/ under the Studio\Totem\Tests namespace, keeping test-only code out of the production classmap. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: use ::class constants in TotemEventServiceProvider * fix: remove unused Deleted import from TotemEventServiceProvider Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * build: replace laravel-elixir/webpack with Vite 5 + Vue 3 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: remove unused lodash, fix assetFileNames for non-CSS assets Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: migrate app.js to Vue 3 createApp, extract composables Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: migrate ClickToClose and UIKitModal to Vue 3 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: remove unused h import from ClickToClose.vue Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: remove inline-template from TaskType.vue, convert to proper SFC Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: migrate all Vue components to Vue 3 Composition API Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: remove dangling dropdown ref, add EOF newline Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * refactor: replace moment.js with dayjs in UpcomingCalendar Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * build: rebuild frontend bundle with Vue 3 + Vite + dayjs Fix Vue 3 template v-for key placement in UpcomingCalendar.vue, update vite.config.js for Vite 6 compatibility (cssFileName, outDir restructure, publicDir: false), add components.css to layout. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Apply fixes from StyleCI (#408) * Only test laravel 11 and 12 * test: add coverage for HasFrequencies, getCommands, TaskRequest validation, and notifications - HasFrequenciesTest: frequency creation, removal on update, deletion on type change - TotemCommandsTest: no-filter passthrough, whitelist, blacklist filtering - TaskRequestTest: required fields, cron validation, frequency, email/phone format - VonageNotificationTest: mail/slack channels and toMail()/toSlack() content - Add laravel/slack-notification-channel to require-dev and suggest (toSlack() requires this package, same pattern as Vonage) --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 32a3ca7 commit dd0aa0d

73 files changed

Lines changed: 1491 additions & 67252 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/laravel.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
matrix:
1111
os: [ ubuntu-latest ]
1212
php: [ 8.2, 8.3, 8.4 ]
13-
laravel: [ 10.*, 11.*, 12.* ]
13+
laravel: [ 11.*, 12.* ]
1414
stability: [ prefer-stable ]
1515
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
1616

composer.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,30 @@
3030
"illuminate/notifications": "^10.0|^11.0|^12.0"
3131
},
3232
"require-dev": {
33-
"orchestra/testbench" : "^8.0|^9.0|^10.0",
33+
"laravel/slack-notification-channel": "^3.7",
34+
"laravel/vonage-notification-channel": "^3.3",
35+
"orchestra/testbench": "^8.0|^9.0|^10.0",
3436
"phpunit/phpunit": "^10.0|^11.0|^12.0"
3537
},
3638
"suggest": {
37-
"nexmo/client": "Required for sms notifications."
39+
"laravel/slack-notification-channel": "Required for Slack notifications.",
40+
"laravel/vonage-notification-channel": "Required for SMS notifications via Vonage."
3841
},
3942
"autoload": {
4043
"psr-4": {
4144
"Studio\\Totem\\": "src/",
42-
"Studio\\Totem\\Tests\\": "tests/",
4345
"Database\\Factories\\": "database/factories/",
4446
"Database\\Seeders\\": "database/seeders/"
4547
},
4648
"files": [
4749
"src/helpers.php"
4850
]
4951
},
52+
"autoload-dev": {
53+
"psr-4": {
54+
"Studio\\Totem\\Tests\\": "tests/"
55+
}
56+
},
5057
"extra": {
5158
"component": "package",
5259
"laravel": {

config/totem.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,9 +220,6 @@
220220
'middleware' => env('TOTEM_WEB_MIDDLEWARE', 'web'),
221221
'route_prefix' => env('TOTEM_WEB_ROUTE_PREFIX', 'totem'),
222222
],
223-
'api' => [
224-
'middleware' => env('TOTEM_API_MIDDLEWARE', 'api'),
225-
],
226223
'table_prefix' => env('TOTEM_TABLE_PREFIX', ''),
227224
'artisan' => [
228225
'command_filter' => [],

database/migrations/2017_08_05_194349_create_tasks_table.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class CreateTasksTable extends TotemMigration
1313
*/
1414
public function up()
1515
{
16-
Schema::connection(TOTEM_DATABASE_CONNECTION)
17-
->create(TOTEM_TABLE_PREFIX.'tasks', function (Blueprint $table) {
16+
Schema::connection($this->getConnection())
17+
->create($this->prefix().'tasks', function (Blueprint $table) {
1818
$table->increments('id');
1919
$table->string('description');
2020
$table->string('command');
@@ -36,7 +36,7 @@ public function up()
3636
*/
3737
public function down()
3838
{
39-
Schema::connection(TOTEM_DATABASE_CONNECTION)
40-
->dropIfExists(TOTEM_TABLE_PREFIX.'tasks');
39+
Schema::connection($this->getConnection())
40+
->dropIfExists($this->prefix().'tasks');
4141
}
4242
}

database/migrations/2017_08_05_195539_create_task_frequencies_table.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class CreateTaskFrequenciesTable extends TotemMigration
1313
*/
1414
public function up()
1515
{
16-
Schema::connection(TOTEM_DATABASE_CONNECTION)
17-
->create(TOTEM_TABLE_PREFIX.'task_frequencies', function (Blueprint $table) {
16+
Schema::connection($this->getConnection())
17+
->create($this->prefix().'task_frequencies', function (Blueprint $table) {
1818
$table->increments('id');
1919
$table->unsignedInteger('task_id');
2020
$table->string('label');
@@ -30,7 +30,7 @@ public function up()
3030
*/
3131
public function down()
3232
{
33-
Schema::connection(TOTEM_DATABASE_CONNECTION)
34-
->dropIfExists(TOTEM_TABLE_PREFIX.'task_frequencies');
33+
Schema::connection($this->getConnection())
34+
->dropIfExists($this->prefix().'task_frequencies');
3535
}
3636
}

database/migrations/2017_08_05_201914_create_task_results_table.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class CreateTaskResultsTable extends TotemMigration
1313
*/
1414
public function up()
1515
{
16-
Schema::connection(TOTEM_DATABASE_CONNECTION)
17-
->create(TOTEM_TABLE_PREFIX.'task_results', function (Blueprint $table) {
16+
Schema::connection($this->getConnection())
17+
->create($this->prefix().'task_results', function (Blueprint $table) {
1818
$table->increments('id');
1919
$table->unsignedInteger('task_id');
2020
$table->timestamp('ran_at')->useCurrent();
@@ -31,7 +31,7 @@ public function up()
3131
*/
3232
public function down()
3333
{
34-
Schema::connection(TOTEM_DATABASE_CONNECTION)
35-
->dropIfExists(TOTEM_TABLE_PREFIX.'task_results');
34+
Schema::connection($this->getConnection())
35+
->dropIfExists($this->prefix().'task_results');
3636
}
3737
}

database/migrations/2017_08_24_085132_create_frequency_parameters_table.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class CreateFrequencyParametersTable extends TotemMigration
1313
*/
1414
public function up()
1515
{
16-
Schema::connection(TOTEM_DATABASE_CONNECTION)
17-
->create(TOTEM_TABLE_PREFIX.'frequency_parameters', function (Blueprint $table) {
16+
Schema::connection($this->getConnection())
17+
->create($this->prefix().'frequency_parameters', function (Blueprint $table) {
1818
$table->increments('id');
1919
$table->unsignedInteger('frequency_id');
2020
$table->string('name');
@@ -30,7 +30,7 @@ public function up()
3030
*/
3131
public function down()
3232
{
33-
Schema::connection(TOTEM_DATABASE_CONNECTION)
34-
->dropIfExists(TOTEM_TABLE_PREFIX.'frequency_parameters');
33+
Schema::connection($this->getConnection())
34+
->dropIfExists($this->prefix().'frequency_parameters');
3535
}
3636
}

database/migrations/2017_08_26_083622_alter_tasks_table_add_notifications_fields.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class AlterTasksTableAddNotificationsFields extends TotemMigration
1313
*/
1414
public function up()
1515
{
16-
Schema::connection(TOTEM_DATABASE_CONNECTION)
17-
->table(TOTEM_TABLE_PREFIX.'tasks', function (Blueprint $table) {
16+
Schema::connection($this->getConnection())
17+
->table($this->prefix().'tasks', function (Blueprint $table) {
1818
$table->string('notification_phone_number')->nullable()->after('notification_email_address');
1919
$table->string('notification_slack_webhook')->nullable()->after('notification_phone_number');
2020
});
@@ -27,13 +27,13 @@ public function up()
2727
*/
2828
public function down()
2929
{
30-
Schema::connection(TOTEM_DATABASE_CONNECTION)
31-
->table(TOTEM_TABLE_PREFIX.'tasks', function (Blueprint $table) {
30+
Schema::connection($this->getConnection())
31+
->table($this->prefix().'tasks', function (Blueprint $table) {
3232
$table->dropColumn('notification_phone_number');
3333
});
3434

35-
Schema::connection(TOTEM_DATABASE_CONNECTION)
36-
->table(TOTEM_TABLE_PREFIX.'tasks', function (Blueprint $table) {
35+
Schema::connection($this->getConnection())
36+
->table($this->prefix().'tasks', function (Blueprint $table) {
3737
$table->dropColumn('notification_slack_webhook');
3838
});
3939
}

database/migrations/2018_01_02_121533_alter_tasks_table_add_auto_cleanup_num_and_type_fields.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class AlterTasksTableAddAutoCleanupNumAndTypeFields extends TotemMigration
1313
*/
1414
public function up()
1515
{
16-
Schema::connection(TOTEM_DATABASE_CONNECTION)
17-
->table(TOTEM_TABLE_PREFIX.'tasks', function (Blueprint $table) {
16+
Schema::connection($this->getConnection())
17+
->table($this->prefix().'tasks', function (Blueprint $table) {
1818
$table->integer('auto_cleanup_num')->default(0);
1919
$table->string('auto_cleanup_type', 20)->nullable();
2020
});
@@ -27,13 +27,13 @@ public function up()
2727
*/
2828
public function down()
2929
{
30-
Schema::connection(TOTEM_DATABASE_CONNECTION)
31-
->table(TOTEM_TABLE_PREFIX.'tasks', function (Blueprint $table) {
30+
Schema::connection($this->getConnection())
31+
->table($this->prefix().'tasks', function (Blueprint $table) {
3232
$table->dropColumn('auto_cleanup_num');
3333
});
3434

35-
Schema::connection(TOTEM_DATABASE_CONNECTION)
36-
->table(TOTEM_TABLE_PREFIX.'tasks', function (Blueprint $table) {
35+
Schema::connection($this->getConnection())
36+
->table($this->prefix().'tasks', function (Blueprint $table) {
3737
$table->dropColumn('auto_cleanup_type');
3838
});
3939
}

database/migrations/2018_07_03_120000_alter_tasks_table_add_run_on_one_server_support.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class AlterTasksTableAddRunOnOneServerSupport extends TotemMigration
1313
*/
1414
public function up()
1515
{
16-
Schema::connection(TOTEM_DATABASE_CONNECTION)
17-
->table(TOTEM_TABLE_PREFIX.'tasks', function (Blueprint $table) {
16+
Schema::connection($this->getConnection())
17+
->table($this->prefix().'tasks', function (Blueprint $table) {
1818
$table->boolean('run_on_one_server')->default(false);
1919
});
2020
}
@@ -26,8 +26,8 @@ public function up()
2626
*/
2727
public function down()
2828
{
29-
Schema::connection(TOTEM_DATABASE_CONNECTION)
30-
->table(TOTEM_TABLE_PREFIX.'tasks', function (Blueprint $table) {
29+
Schema::connection($this->getConnection())
30+
->table($this->prefix().'tasks', function (Blueprint $table) {
3131
$table->dropColumn('run_on_one_server');
3232
});
3333
}

0 commit comments

Comments
 (0)