Skip to content

Commit

Permalink
Merge pull request #1 from rupadana/1.0.0
Browse files Browse the repository at this point in the history
update readme.md
  • Loading branch information
rupadana authored Aug 26, 2023
2 parents 16333f9 + a21df5d commit d6ee6bf
Showing 1 changed file with 27 additions and 34 deletions.
61 changes: 27 additions & 34 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,9 @@
# A simple api service for supporting filamentphp

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

This is where your description should go. Limit it to a paragraph or two. Consider adding a small example.

## Support us

[<img src="https://github-ads.s3.eu-central-1.amazonaws.com/filament-api-service.jpg?t=1" width="419px" />](https://spatie.be/github-ad-click/filament-api-service)

We invest a lot of resources into creating [best in class open source packages](https://spatie.be/open-source). You can support us by [buying one of our paid products](https://spatie.be/open-source/support-us).

We highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using. You'll find our address on [our contact page](https://spatie.be/about-us). We publish all received postcards on [our virtual postcard wall](https://spatie.be/open-source/postcards).

## Installation

Expand All @@ -23,43 +13,46 @@ You can install the package via composer:
composer require rupadana/filament-api-service
```

You can publish and run the migrations with:

```bash
php artisan vendor:publish --tag="filament-api-service-migrations"
php artisan migrate
```

You can publish the config file with:
## Usage

```bash
php artisan vendor:publish --tag="filament-api-service-config"
php artisan make:filament-api-service BlogResource
```

This is the contents of the published config file:
Add this code to your routes file, example in routes/api.php

```php
return [
];
...
use App\Filament\Resources\BlogResource\Api;
...

BlogApiService::routes();
```

Optionally, you can publish the views using
and then you will got this routes;

```bash
php artisan vendor:publish --tag="filament-api-service-views"
```
| Route | Description |
-----------------------
| '/api/blogs' | This will return LengthAwarePaginator |
| '/api/blogs/1' | This will return single resource |

## Usage

```php
$filamentApiService = new Rupadana\FilamentApiService();
echo $filamentApiService->echoPhrase('Hello, Rupadana!');
```
Im using `"spatie/laravel-query-builder": "^5.3"` to handle query and filtering. u can see `"spatie/laravel-query-builder": "^5.3"` [https://spatie.be/docs/laravel-query-builder/v5/introduction](documentation)

## Testing

```bash
composer test
You can specified `allowedFilters` and `allowedFields` in your model

Example
```php
class User extends Model {
public static array $allowedFilters = [
'name'
];

public static array $allowedFields = [
'name'
];
}
```

## Changelog
Expand Down

0 comments on commit d6ee6bf

Please sign in to comment.