From 4a0bd8f7e47c16f44c9c3913f7e88096a29057ef Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Fri, 7 Jun 2024 15:04:50 +0800 Subject: [PATCH 1/4] Fix helper list anchors --- services/helpers.md | 91 +++++++++++++++++++++++---------------------- 1 file changed, 46 insertions(+), 45 deletions(-) diff --git a/services/helpers.md b/services/helpers.md index 258a7c56..803c833e 100644 --- a/services/helpers.md +++ b/services/helpers.md @@ -1,3 +1,4 @@ + # Helpers Winter includes a variety of "helper" PHP functions. Many of these functions are used internally by Winter itself, however, you are free to use them in your own plugins and applications if you find them useful. @@ -9,22 +10,22 @@ For more useful methods, you should also review the [Laravel `Arr::*()` helpers]
-- [array_add](#array_add) -- [array_divide](#array_divide) -- [array_dot](#array_dot) -- [array_undot](#array_undot) -- [array_except](#array_except) -- [array_first](#array_first) -- [array_flatten](#array_flatten) -- [array_forget](#array_forget) -- [array_get](#array_get) -- [array_only](#array_only) -- [array_pluck](#array_pluck) -- [array_pull](#array_pull) -- [array_set](#array_set) -- [array_sort](#array_sort) -- [array_sort_recursive](#array_sort_recursive) -- [array_where](#array_where) +- [array_add](#arrayadd) +- [array_divide](#arraydivide) +- [array_dot](#arraydot) +- [array_undot](#arrayundot) +- [array_except](#arrayexcept) +- [array_first](#arrayfirst) +- [array_flatten](#arrayflatten) +- [array_forget](#arrayforget) +- [array_get](#arrayget) +- [array_only](#arrayonly) +- [array_pluck](#arraypluck) +- [array_pull](#arraypull) +- [array_set](#arrayset) +- [array_sort](#arraysort) +- [array_sort_recursive](#arraysortrecursive) +- [array_where](#arraywhere) - [head](#head) - [last](#last) @@ -36,17 +37,17 @@ Paths
- [Path Symbols](#path-symbols) -- [app_path](#app_path) -- [base_path](#base_path) -- [config_path](#config_path) -- [database_path](#database_path) -- [media_path](#media_path) -- [plugins_path](#plugins_path) -- [public_path](#public_path) -- [storage_path](#storage_path) -- [temp_path](#temp_path) -- [themes_path](#themes_path) -- [uploads_path](#uploads_path) +- [app_path](#apppath) +- [base_path](#basepath) +- [config_path](#configpath) +- [database_path](#databasepath) +- [media_path](#mediapath) +- [plugins_path](#pluginspath) +- [public_path](#publicpath) +- [storage_path](#storagepath) +- [temp_path](#temppath) +- [themes_path](#themespath) +- [uploads_path](#uploadspath)
@@ -57,23 +58,23 @@ For more useful methods, you should also review the [Laravel `Str::*()` helpers]
-- [camel_case](#camel_case) -- [class_basename](#class_basename) +- [camel_case](#camelcase) +- [class_basename](#classbasename) - [e](#e) -- [ends_with](#ends_with) -- [snake_case](#snake_case) -- [str_limit](#str_limit) -- [starts_with](#starts_with) -- [str_contains](#str_contains) -- [str_finish](#str_finish) -- [str_is](#str_is) -- [str_plural](#str_plural) -- [str_random](#str_random) -- [str_singular](#str_singular) -- [str_slug](#str_slug) -- [studly_case](#studly_case) +- [ends_with](#endswith) +- [snake_case](#snakecase) +- [str_limit](#strlimit) +- [starts_with](#startswith) +- [str_contains](#strcontains) +- [str_finish](#strfinish) +- [str_is](#stris) +- [str_plural](#strplural) +- [str_random](#strrandom) +- [str_singular](#strsingular) +- [str_slug](#strslug) +- [studly_case](#studlycase) - [trans](#trans) -- [trans_choice](#trans_choice) +- [trans_choice](#transchoice)
@@ -102,9 +103,9 @@ Miscellaneous - [request](#request) - [response](#response) - [route](#route) -- [secure_asset](#secure_asset) -- [trace_log](#trace_log) -- [trace_sql](#trace_sql) +- [secure_asset](#secureasset) +- [trace_log](#tracelog) +- [trace_sql](#tracesql) - [url](#url)
From ff33d9bde4bd925b318fe089bb70a0e6f4a6ddc3 Mon Sep 17 00:00:00 2001 From: Naoki Miyazaki-Chapleau <104367522+nmiyazaki-chapleau@users.noreply.github.com> Date: Fri, 7 Jun 2024 14:55:38 -0400 Subject: [PATCH 2/4] Fix typo --- console/asset-compilation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/console/asset-compilation.md b/console/asset-compilation.md index 7cf96edd..54fee544 100644 --- a/console/asset-compilation.md +++ b/console/asset-compilation.md @@ -2,7 +2,7 @@ ## Introduction -Winter brings first-class support for handling Node-based compilation for frontend assets through the Mix commands. The comamnds use the [Laravel Mix](https://laravel-mix.com/) wrapper, a user-friendly and simple interface for setting up compilation of multiple types of frontend assets through Webpack and various libraries. +Winter brings first-class support for handling Node-based compilation for frontend assets through the Mix commands. The commands use the [Laravel Mix](https://laravel-mix.com/) wrapper, a user-friendly and simple interface for setting up compilation of multiple types of frontend assets through Webpack and various libraries. ### Requirements From 2b84f6c17a044d06b2593b2cacabdd85b525b275 Mon Sep 17 00:00:00 2001 From: Luke Towers Date: Fri, 12 Jul 2024 00:14:42 -0600 Subject: [PATCH 3/4] Document dropColumnIfExists() Refs: https://github.com/wintercms/storm/commit/2fcb050bdbc051c25e0a94485a0a46d0b87dd119 --- database/structure.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/database/structure.md b/database/structure.md index 5a0fbff5..d6a9bd32 100644 --- a/database/structure.md +++ b/database/structure.md @@ -217,6 +217,23 @@ Schema::table('users', function ($table) { }); ``` +You can also use the `dropColumnIfExists` method on the Schema builder for a slightly safer way of handling migrations: + +```php +Schema::table('users', function ($table) { + $table->dropColumnIfExists('single_column'); + // or + $table->dropColumnIfExists('one_column', 'two_column'); + // or + $table->dropColumnIfExists([ + 'one_column', + 'two_column', + 'red_column', + 'blue_column', + ]); +} +``` + ### Creating indexes The schema builder supports several types of indexes. First, let's look at an example that specifies a column's values should be unique. To create the index, we can simply chain the `unique` method onto the column definition: From 80f0763a59296c7e4589f78bc4fe17e598eb586f Mon Sep 17 00:00:00 2001 From: Ben Thomson Date: Fri, 19 Jul 2024 09:41:11 +0800 Subject: [PATCH 4/4] Simplify GitHub Action example --- plugin/unit-testing.md | 35 +++++++++++++---------------------- 1 file changed, 13 insertions(+), 22 deletions(-) diff --git a/plugin/unit-testing.md b/plugin/unit-testing.md index a53089df..2390443d 100644 --- a/plugin/unit-testing.md +++ b/plugin/unit-testing.md @@ -137,43 +137,34 @@ name: Tests on: push: + pull_request: jobs: unitTests: runs-on: ubuntu-latest name: Unit Tests steps: + - name: Checkout Winter CMS + uses: actions/checkout@v4 + with: + repository: wintercms/winter + ref: develop # change this to a different branch or tag name if you wish to test with a specific version of Winter CMS + - name: Checkout code uses: actions/checkout@v4 with: - path: my-plugin + path: plugins/my-author/my-plugin # change this to the correct folder for your plugin - - name: Setup PHP and extensions + - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: 8.1 + php-version: 8.3 # change this if you wish to test a different PHP version extensions: mbstring, intl, gd, xml, sqlite tools: composer:v2 - - name: Install Winter - run: | - wget https://github.com/wintercms/winter/archive/develop.zip - unzip develop.zip - rm develop.zip - - # Move Winter CMS into place - shopt -s dotglob - mv winter-develop/* ./ - rmdir winter-develop - shopt -u dotglob - mv config/cms.php config/testing/cms.php - - # Move plugin into place (note that the paths below should be changed to match your plugin path) - mkdir -p plugins/myauthor - mv my-plugin plugins/myauthor/myplugin - - name: Install Composer dependencies - run: composer install --no-interaction --no-progress + run: composer install --no-interaction --no-progress --no-scripts - name: Run unit tests - run: php artisan winter:test -p MyAuthor.MyPlugin + run: php artisan winter:test -p MyAuthor.MyPlugin # change this to the correct plugin code +```