Skip to content

Commit 3d0ba32

Browse files
committed
updates for filament v4
1 parent bcc64fc commit 3d0ba32

38 files changed

+9686
-4486
lines changed

.github/workflows/build-assets.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.
Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,33 @@
1-
name: "Fix PHP code styling"
1+
name: 'Fix PHP Code Styling'
22

33
on:
4+
workflow_dispatch:
45
pull_request:
56
types:
67
- closed
8+
branches:
9+
- 4.x
10+
paths:
11+
- '**.php'
12+
13+
permissions:
14+
contents: write
715

816
jobs:
917
if_merged:
1018
if: github.event.pull_request.merged == true
1119
runs-on: ubuntu-latest
12-
1320
steps:
1421
- name: Checkout code
1522
uses: actions/checkout@v4
23+
with:
24+
ref: ${{ github.head_ref }}
1625

1726
- name: Fix PHP code style issues
18-
uses: aglipanci/laravel-pint-action@2.5
27+
uses: aglipanci/laravel-pint-action@v2
1928

2029
- name: Commit changes
2130
uses: stefanzweifel/git-auto-commit-action@v6
2231
with:
23-
commit_message: "Chore: Fix PHP code styling"
32+
commit_message: "Format Code"
33+
commit_user_name: 'GitHub Actions'

.github/workflows/tests.yml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
name: "Tests"
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
types:
7+
- opened
8+
- synchronize
9+
branches:
10+
- 4.x
11+
paths:
12+
- '**.php'
13+
- '.github/workflows/tests.yml'
14+
- 'phpunit.xml.dist'
15+
- 'composer.json'
16+
- 'composer.lock'
17+
18+
jobs:
19+
test:
20+
runs-on: ${{ matrix.os }}
21+
strategy:
22+
fail-fast: true
23+
matrix:
24+
os: [ubuntu-latest]
25+
php: [8.3, 8.2]
26+
laravel: [12.*, 11.*]
27+
stability: [prefer-stable]
28+
include:
29+
- laravel: 12.*
30+
testbench: 10.*
31+
carbon: 3.*
32+
collision: 8.*
33+
- laravel: 11.*
34+
testbench: 9.*
35+
carbon: 3.*
36+
collision: 8.*
37+
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
38+
steps:
39+
- name: Checkout Code
40+
uses: actions/checkout@v4
41+
42+
- name: Cache Dependencies
43+
uses: actions/cache@v4
44+
with:
45+
path: ~/.composer/cache/files
46+
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
47+
48+
- name: Setup PHP
49+
uses: shivammathur/setup-php@v2
50+
with:
51+
php-version: ${{ matrix.php }}
52+
extensions: dom, curl, libxml, mbstring, zip, pcntl, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
53+
coverage: none
54+
55+
- name: Install Dependencies
56+
run: |
57+
echo "::add-matcher::${{ runner.tool_cache }}/php.json"
58+
echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
59+
60+
- name: Install Dependencies
61+
run: |
62+
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" "nesbot/carbon:${{ matrix.carbon }}" "nunomaduro/collision:${{ matrix.collision }}" --no-interaction --no-update
63+
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
64+
65+
- name: Execute tests
66+
run: vendor/bin/pest --parallel

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
.DS_Store
1+
**/.DS_Store
22
.idea
33
.php_cs
44
.php_cs.cache
55
.php-cs-fixer.cache
66
.phpunit.result.cache
7+
.phpunit.cache
78
.vscode
89
build
910
composer.lock
@@ -13,4 +14,4 @@ node_modules
1314
phpunit.xml
1415
phpstan.neon
1516
testbench.yaml
16-
vendor
17+
vendor

README.md

Lines changed: 53 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
1-
# Quick Create for Filament
1+
![quick-create-og](https://res.cloudinary.com/aw-codes/image/upload/w_1200,f_auto,q_auto/plugins/quick-create/awcodes-quick-create.jpg)
2+
[![Latest Version on Packagist](https://img.shields.io/packagist/v/awcodes/filament-quick-create.svg?style=flat-square)](https://packagist.org/packages/awcodes/filament-quick-create)
3+
[![Total Downloads](https://img.shields.io/packagist/dt/awcodes/filament-quick-create.svg?style=flat-square)](https://packagist.org/packages/awcodes/filament-quick-create)
24

3-
Plugin for [Filament Admin Panel](https://filamentphp.com) that adds a dropdown menu to the header to quickly create new items from anywhere in your app.
5+
# Quick Create
46

5-
![quick-create-og](https://res.cloudinary.com/aw-codes/image/upload/w_1200,f_auto,q_auto/plugins/quick-create/awcodes-quick-create.jpg)
7+
Plugin for [Filament Panels](https://filamentphp.com) that adds a dropdown menu to the header to quickly create new items from anywhere in your app.
8+
9+
## Compatibility
10+
11+
| Package Version | Filament Version |
12+
|-----------------|------------------|
13+
| 2.x | 2.x |
14+
| 3.x | 3.x |
15+
| 4.x | 4.x |
16+
17+
## Upgrading from v2 to v3
18+
19+
If you are upgrading from version 2 to version 3, you will need to update the namespace anywhere you are using the plugin from `Awcodes\FilamentQuickCreate` to `Awcodes\QuickCreate`.
620

721
## Installation
822

@@ -12,17 +26,13 @@ Install the package via composer
1226
composer require awcodes/filament-quick-create
1327
```
1428

15-
In an effort to align with Filament's theming methodology you will need to use a custom theme to use this plugin.
29+
> [!IMPORTANT]
30+
> If you have not set up a custom theme and are using Filament Panels follow the instructions in the [Filament Docs](https://filamentphp.com/docs/4.x/styling/overview#creating-a-custom-theme) first.
1631
17-
> **Note**
18-
> If you have not set up a custom theme and are using a Panel follow the instructions in the [Filament Docs](https://filamentphp.com/docs/3.x/panels/themes#creating-a-custom-theme) first. The following applies to both the Panels Package and the standalone Forms package.
32+
After setting up a custom theme add the plugin's views to your theme css file.
1933

20-
Add the plugin's views to your `tailwind.config.js` file.
21-
22-
```js
23-
content: [
24-
'<path-to-vendor>/awcodes/filament-quick-create/resources/**/*.blade.php',
25-
]
34+
```css
35+
@source '../../../../vendor/awcodes/filament-quick-create/resources/**/*.blade.php';
2636
```
2737

2838
## Usage
@@ -32,7 +42,7 @@ By default, Quick Create will use all resources that are registered with current
3242
### Registering the plugin
3343

3444
```php
35-
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
45+
use Awcodes\QuickCreate\QuickCreatePlugin;
3646

3747
public function panel(Panel $panel): Panel
3848
{
@@ -51,7 +61,7 @@ public function panel(Panel $panel): Panel
5161
Excluding resources will filter them out of the registered resources to prevent them from displaying in the dropdown.
5262

5363
```php
54-
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
64+
use Awcodes\QuickCreate\QuickCreatePlugin;
5565

5666
public function panel(Panel $panel): Panel
5767
{
@@ -70,7 +80,7 @@ public function panel(Panel $panel): Panel
7080
Sometimes, it might be easier to only include some resources instead of filtering them out. For instance, you have 30 resources but only want to display 3 to 4 in the dropdown.
7181

7282
```php
73-
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
83+
use Awcodes\QuickCreate\QuickCreatePlugin;
7484

7585
public function panel(Panel $panel): Panel
7686
{
@@ -89,7 +99,7 @@ public function panel(Panel $panel): Panel
8999
By default, Quick Create will sort all the displayed options in descending order by Label. This can be disabled should you choose. In which case they will be displayed in the order they are registered with Filament.
90100

91101
```php
92-
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
102+
use Awcodes\QuickCreate\QuickCreatePlugin;
93103

94104
public function panel(Panel $panel): Panel
95105
{
@@ -106,7 +116,7 @@ public function panel(Panel $panel): Panel
106116
By default, Quick Create will sort all the displayed options by Label. This can be changed to resource navigation sort should you choose. In which case they will be displayed in the order they are displayed in the navigation.
107117

108118
```php
109-
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
119+
use Awcodes\QuickCreate\QuickCreatePlugin;
110120

111121
public function panel(Panel $panel): Panel
112122
{
@@ -123,7 +133,7 @@ public function panel(Panel $panel): Panel
123133
You can attach keyboard shortcuts to trigger the Quick Create dropdown. To configure these, pass the keyBindings() method to the configuration:
124134

125135
```php
126-
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
136+
use Awcodes\QuickCreate\QuickCreatePlugin;
127137

128138
public function panel(Panel $panel): Panel
129139
{
@@ -140,7 +150,7 @@ public function panel(Panel $panel): Panel
140150
By default, the ability to create another record will respect the settings of your 'create record' or 'list records' create action. This can be overridden to either enable or disable it for all resources with the `createAnother()` method.
141151

142152
```php
143-
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
153+
use Awcodes\QuickCreate\QuickCreatePlugin;
144154

145155
public function panel(Panel $panel): Panel
146156
{
@@ -159,7 +169,7 @@ public function panel(Panel $panel): Panel
159169
By default, the Quick Create button will be fully rounded if you would like to have a more square button you can disable the rounding with the `rounded()` method.
160170

161171
```php
162-
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
172+
use Awcodes\QuickCreate\QuickCreatePlugin;
163173

164174
public function panel(Panel $panel): Panel
165175
{
@@ -176,7 +186,7 @@ public function panel(Panel $panel): Panel
176186
If you prefer to not show icons for the items in the menu you can disable them with the `hiddenIcons()` method.
177187

178188
```php
179-
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
189+
use Awcodes\QuickCreate\QuickCreatePlugin;
180190

181191
public function panel(Panel $panel): Panel
182192
{
@@ -193,7 +203,7 @@ public function panel(Panel $panel): Panel
193203
If you prefer to show a label with the plus icon you can set it using the `label()` method and passing your label to it.
194204

195205
```php
196-
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
206+
use Awcodes\QuickCreate\QuickCreatePlugin;
197207

198208
public function panel(Panel $panel): Panel
199209
{
@@ -210,7 +220,7 @@ public function panel(Panel $panel): Panel
210220
By default, Quick Create will render simple resources in a standard modal. If you would like to render them in a slide over instead you may use the `slideOver()` modifier to do so.
211221

212222
```php
213-
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
223+
use Awcodes\QuickCreate\QuickCreatePlugin;
214224

215225
public function panel(Panel $panel): Panel
216226
{
@@ -227,7 +237,7 @@ public function panel(Panel $panel): Panel
227237
By default, Quick Create is visible if there are registered resources. If you would like to hide it you may use the `hidden()` modifier to do so.
228238

229239
```php
230-
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
240+
use Awcodes\QuickCreate\QuickCreatePlugin;
231241

232242
public function panel(Panel $panel): Panel
233243
{
@@ -244,7 +254,7 @@ public function panel(Panel $panel): Panel
244254
By default, Quick Create plugin renders using `'panels::user-menu.before'` Filament Panel Render Hook. If you would like to customize this to render at a different render hook, you may use the `renderUsingHook(string $panelHook)` modifier to do so. You may read about the available Render Hooks in Filament PHP [here](https://filamentphp.com/docs/3.x/support/render-hooks#available-render-hooks)
245255

246256
```php
247-
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
257+
use Awcodes\QuickCreate\QuickCreatePlugin;
248258
use Filament\View\PanelsRenderHook;
249259

250260
public function panel(Panel $panel): Panel
@@ -262,7 +272,7 @@ public function panel(Panel $panel): Panel
262272
Quick create will automatically determine if it should redirect to a create page or to show the form in a modal based on the resource. If you prefer to force all items to be show in a modal you can do so with the `alwaysShowModal()` modifier.
263273

264274
```php
265-
use Awcodes\FilamentQuickCreate\QuickCreatePlugin;
275+
use Awcodes\QuickCreate\QuickCreatePlugin;
266276

267277
public function panel(Panel $panel): Panel
268278
{
@@ -273,3 +283,20 @@ public function panel(Panel $panel): Panel
273283
])
274284
}
275285
```
286+
287+
## Contributing
288+
289+
Please see [CONTRIBUTING](.github/CONTRIBUTING.md) for details.
290+
291+
## Security Vulnerabilities
292+
293+
Please review [our security policy](.github/SECURITY.md) on how to report security vulnerabilities.
294+
295+
## Credits
296+
297+
- [Adam Weston](https://github.com/awcodes)
298+
- [All Contributors](../../contributors)
299+
300+
## License
301+
302+
The MIT License (MIT). Please see [License File](LICENSE.md) for more information.

0 commit comments

Comments
 (0)