Skip to content

Commit

Permalink
Documentation and workflows:
Browse files Browse the repository at this point in the history
- Added documentation for v3
- Adjusted workflows to run on branch 3.x as well.
  • Loading branch information
coolsam726 committed Jul 24, 2023
1 parent 77b3b3b commit 22f273d
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 12 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ name: run-tests

on:
push:
branches: [main]
branches:
- main
- 3.x
pull_request:
branches: [main]
branches:
- main
- 3.x

jobs:
test:
Expand Down
66 changes: 56 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,79 @@
<p align="center">
<a href="https://github.com/filamentphp/filament/actions"><img alt="Tests passing" src="https://img.shields.io/badge/Tests-passing-green?style=for-the-badge&logo=github"></a>
<a href="https://github.com/savannabits/filament-modules/actions?query=workflow%3Arun-tests+branch%3A3.x"><img alt="Tests passing" src="https://img.shields.io/github/actions/workflow/status/savannabits/filament-modules/run-tests.yml?branch=3.x&label=tests&style=for-the-badge&logo=github"></a>
<a href="https://laravel.com"><img alt="Laravel v9.x" src="https://img.shields.io/badge/Laravel-v9.x-FF2D20?style=for-the-badge&logo=laravel"></a>
<a href="https://laravel-livewire.com"><img alt="Livewire v3.x" src="https://img.shields.io/badge/Livewire-v3.x-FB70A9?style=for-the-badge"></a>
<a href="https://beta.filamentphp.com"><img alt="Filament v3.x" src="https://img.shields.io/badge/FilamentPHP-v3.x-FB70A9?style=for-the-badge&logo=filament"></a>
<a href="https://php.net"><img alt="PHP 8.1" src="https://img.shields.io/badge/PHP-8.1-777BB4?style=for-the-badge&logo=php"></a>
<a href="https://packagist.org/packages/coolsam/modules"><img alt="Packagist" src="https://img.shields.io/packagist/dt/coolsam/modules.svg?style=for-the-badge&logo=download"></a>
</p>

[![Latest Version on Packagist](https://img.shields.io/packagist/v/coolsam/modules.svg?style=flat-square)](https://packagist.org/packages/coolsam/modules)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/coolsam/modules/run-tests.yml?branch=main&label=tests&style=flat-square)](https://github.com/coolsam/modules/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Tests Action Status](https://img.shields.io/github/actions/workflow/status/coolsam/modules/laravel.yml?branch=main&label=tests&style=flat-square)](https://github.com/coolsam/modules/actions?query=workflow%3Arun-tests+branch%3Amain)
[![GitHub Code Style Action Status](https://img.shields.io/github/actions/workflow/status/coolsam/modules/fix-php-code-style-issues.yml?branch=main&label=code%20style&style=flat-square)](https://github.com/coolsam/modules/actions?query=workflow%3A"Fix+PHP+code+style+issues"+branch%3Amain)
[![Total Downloads](https://img.shields.io/packagist/dt/coolsam/modules.svg?style=flat-square)](https://packagist.org/packages/coolsam/modules)

Modules is a FilamentPHP Plugin to enable easy integration with `nwidart/laravel-modules`

**NB: These docs are for v3, which only supports Filament 3. If you are using Filament v2, [see the documentation here](https://github.com/savannabits/filament-modules/tree/main#readme) to get started.**
**NB: These docs are for v3, which only supports Filament 3. If you are using Filament
v2, [see the documentation here](https://github.com/savannabits/filament-modules/tree/main#readme) to get started.**

## Installation

You can install the package via composer:
Requirements:

1. Filament >= 3
2. PHP >= 8.1
3. Laravel >= 9.0
4. Livewire >= 3.0
5. lwidart/laravel-modules >=10.0

## Installation

- Ensure you have insalled and configured [Laravel Modules (follow these instructions)]()
- Ensure you have installed and configured Filamentphp (follow these instructions)
- You can now install the package via composer:

```bash
composer require coolsam/modules
```

## Usage
1. Create your module:
2. Generate a new Panel inside your module
3. Generate your resources, pages and widgets as usual, selecting the panel you just created above.
4. All Done!
``

In this guide we are going to use the `Blog module` as an example

### Create your laravel module:
If the module that you want to work on does not exist, create it using nwidart/laravel-modules

```bash
php artisan module:make Blog # Create the blog module
```

### Generate a new Panel inside your module

```bash
php artisan module:make-filament-panel admin Blog # php artisan module:make-filament-panel [id] [module]
```
If none of the two arguments are passed, the command will ask for each of them interactively.
In this example, if the Panel id passed is `admin` and the module is blog, the command will generate a panel with
id `blog::admin`. This ID should be used in the next step when generating resources, pages and widgets.

### Generate your resources, pages and widgets as usual, selecting the panel you just created above.
From here on, use filament as you would normally to generate `resources`, `Pages` and `Widgets`. Be sure to specify the `--panel` option as the ID generated earlier.
If the `--panel` option is not passed, the command will ask for it interactively.
```bash
# For each of these commands, the package will ask for the Model and Panel.
php artisan make:filament-resource
php artisan make:filament-page
php artisan make:filament-widget
```

```bash
# The Model and Panel arguments are passed inline
php artisan make:filament-resource Author blog::admin
php artisan make:filament-page Library blog::admin
php artisan make:filament-widget BookStats blog::admin
```

**All Done!** For each of the panels generated, you can navigate to your `module-path/panel-path` e.g `blog/admin` to acess your panel and links to resources and pages.
## Testing

```bash
Expand Down

0 comments on commit 22f273d

Please sign in to comment.