Skip to content

Commit

Permalink
only added to documents;
Browse files Browse the repository at this point in the history
  • Loading branch information
hans-thomas committed Jul 15, 2023
1 parent 93a2fcb commit a7d823d
Showing 1 changed file with 23 additions and 2 deletions.
25 changes: 23 additions & 2 deletions docs/content/docs/Basics/resources.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,36 @@ class SampleCollection extends ValravnResourceCollection {
}
```

## Available methods

Resource classes contain several methods and in continue, we will introduce them.

{{< column "methods-container" >}}

{{< column "method" >}}
[only](#only)
{{< /column >}}

{{< /column >}}

##### only

If you just don't need some fields in a specific response, you can reduce your exported fields using this method.

```php
SampleResource::make( $this->model )->only( 'name','email' );
// or in a collection class
SampleCollection::make( $this->models )->only( [ 'email' ] );
```

## Queries

A Query is a class that defines for a resource class and front-end dev can
trigger that using a specific query string.

### Resource Query

This contract can be uses in both `ValravnJsonResource`
and `ValravnResourceCollection`
This contract can be uses in both `ValravnJsonResource` and `ValravnResourceCollection`
classes. first you need to create a class. it's recommended to create the class
in a sub-folder where the resource classes are exist. in addition, it's better
that suffix the classes with `Query` to make recognition easier.
Expand Down

1 comment on commit a7d823d

@vercel
Copy link

@vercel vercel bot commented on a7d823d Jul 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

valravn – ./

valravn-hans-thomas.vercel.app
valravn.vercel.app
valravn-git-master-hans-thomas.vercel.app

Please sign in to comment.