Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
rupadana authored Dec 21, 2023
1 parent 56f4213 commit d82ba7f
Showing 1 changed file with 31 additions and 1 deletion.
32 changes: 31 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,36 @@ php artisan make:filament-api-transformer Blog

it will be create BlogTransformer in `App\Filament\Resources\BlogResource\Api\Transformers`


```php
<?php
namespace App\Filament\Resources\BlogResource\Api\Transformers;

use Illuminate\Http\Resources\Json\JsonResource;

class BlogTransformer extends JsonResource
{

/**
* Transform the resource into an array.
*
* @param \Illuminate\Http\Request $request
* @return array
*/
public function toArray($request)
{
return $this->resource->toArray();

// or

return [
"modified_name" => $this->name . ' so Cool!'
]
}
}
```


next step you need to edit & add it to your Resource

```php
Expand All @@ -102,7 +132,7 @@ next step you need to edit & add it to your Resource

## Group Name & Prefix

You can edit prefix & group route name as you want, default im use model singular label;
You can edit prefix & group route name as you want, default this plugin use model singular label;

```php
class BlogApiService extends ApiService
Expand Down

0 comments on commit d82ba7f

Please sign in to comment.