diff --git a/docs/content/docs/Basics/helpers.md b/docs/content/docs/Basics/helpers.md
index 3dc7a34..7a8da26 100644
--- a/docs/content/docs/Basics/helpers.md
+++ b/docs/content/docs/Basics/helpers.md
@@ -3,9 +3,7 @@ title: "Helpers"
weight: 2
---
-## Traits
-
-### EnumHelper
+## EnumHelper
this trait brings useful static methods to enum classes.
@@ -51,39 +49,39 @@ this trait brings useful static methods to enum classes.
{{< /column >}}
-#### toArray
+##### toArray
Convert values of an enum class to an array.
-#### toArrayKeys
+##### toArrayKeys
Convert keys of an enum class to an array.
-#### toArrayExcept
+##### toArrayExcept
Convert values of an enum class to an array except the given values.
-#### toArrayKeysExcept
+##### toArrayKeysExcept
Convert keys of an enum class to an array except the given keys.
-#### toArrayOnly
+##### toArrayOnly
Convert given values of an enum class to an array.
-#### toArrayKeysOnly
+##### toArrayKeysOnly
Convert given keys of an enum class to an array.
-#### all
+##### all
Create an array using all enum members.
-#### IndexedAll
+##### IndexedAll
Create an array using values of all enum members.
-#### tryFromKey
+##### tryFromKey
Find a value using the given key, otherwise return the default value.
@@ -117,22 +115,22 @@ Valravn includes several global functions that you can use in your code.
{{< /column >}}
-#### user
+##### user
Return authenticated user or optional null.
-#### resolveRelatedIdToModel
+##### resolveRelatedIdToModel
Resolve the given id to a related model.
-#### resolveMorphableToResource
+##### resolveMorphableToResource
Resolve given Model to a resource class.
-#### logg
+##### logg
Log the given exception to a specific channel and format.
-#### slugify
+##### slugify
Make a english or non-english string to a slug.
diff --git a/docs/content/docs/Basics/models.md b/docs/content/docs/Basics/models.md
index 23c1c8a..8a38a1c 100644
--- a/docs/content/docs/Basics/models.md
+++ b/docs/content/docs/Basics/models.md
@@ -34,7 +34,7 @@ string.
domain/api/blog/categories?per_page=5
```
-## Available methods
+#### Available methods
{{< column "methods-container" >}}
@@ -52,7 +52,7 @@ domain/api/blog/categories?per_page=5
{{< /column >}}
-#### aliasForModelAttributes
+##### aliasForModelAttributes
This method is useful when you want to define an alias for an attribute or a
foreign key of a model. its usage should be something like this:
@@ -89,7 +89,7 @@ class Comment extends ValravnModel {
And the `itsPostId` attribute method helps us get the related value using the
same way of a real attribute.
-#### table
+##### table
It's a shorthand for getting table name of a model class.
@@ -99,7 +99,7 @@ Example::table()
( new Example )->getTable();
```
-#### foreignKey
+##### foreignKey
It's a shorthand for getting foreign key of a model class.
diff --git a/docs/content/docs/Basics/repositories.md b/docs/content/docs/Basics/repositories.md
index c813807..92f3c35 100644
--- a/docs/content/docs/Basics/repositories.md
+++ b/docs/content/docs/Basics/repositories.md
@@ -6,7 +6,7 @@ weight: 2
There is a repository base class that contains CRUD and other useful method
which you can use to avoid redundancy.
-### Available methods
+#### Available methods
{{< column "methods-container" >}}
@@ -61,26 +61,26 @@ which you can use to avoid redundancy.
{{< /column >}}
-#### getQueryBuilder
+##### getQueryBuilder
After creating your repository class by your self our using
valravn `repository` [command](commands.md#repository), you must implement this
method to establish related query builder object for repository class.
-#### disableAuthorization
+##### disableAuthorization
Every actions on builder instance should authorize. sometimes you don't want to
authorize your query, so by calling `disableAuthorization` method on your
repository instance, the repository doesn't authorize the action.
-#### enableAuthorization
+##### enableAuthorization
Sometimes you want to run an action without authorization but after that in the
same scope, you want to run an action with authorization. in this scenario, you
need to call `disableAuthorization` method first and after that
call `enableAuthorization` method to enable authorization again.
-#### query
+##### query
When you call an action like `all`, you might don't want all columns of rows. so
you can use `select` method before `all` and pass your specific columns to
@@ -92,7 +92,7 @@ instance.
Notice: it's recommended to get builder instance using `query` method instead of `getQueryBuilder`.
{{< /tip >}}
-#### authorize
+##### authorize
Using this method you will be able to authorize actions. there is some examples.
@@ -144,7 +144,7 @@ public function viewComments( Post $model ): Builder {
}
```
-#### authorizeThisAction
+##### authorizeThisAction
It's just a shorthand for `authorize` method.
@@ -154,11 +154,11 @@ $this->authorizeThisAction( $param );
$this->authorize( null, $param );
```
-#### all
+##### all
Return query builder instance and ables us to access the all rows.
-#### find
+##### find
Find a specific resource using `id` by default. but if you want to find a row by
another column, you just need to do something like this:
@@ -170,20 +170,20 @@ app( SampleRepository::class )->find('specific-slug-for-example','slug');
First parameter is the value and the second value is the column name that
Valravn should search in.
-#### create
+##### create
Create a resource using given data and return the created model as result.
-#### update
+##### update
Update specific Model using given data and return a boolean as result.
-#### batchUpdate
+##### batchUpdate
Update many resources in one query at once and also return a bool value as
result.
-#### delete
+##### delete
Delete a specific resource and return `true`. otherwise throw an
exception. `delete` method contains two `deleting` and `deleted` hook.
diff --git a/docs/content/docs/Basics/resources.md b/docs/content/docs/Basics/resources.md
index 5709d5e..e35f67e 100644
--- a/docs/content/docs/Basics/resources.md
+++ b/docs/content/docs/Basics/resources.md
@@ -8,7 +8,7 @@ classes but there are more features!
You can create resource classes on your own or just using our
[resources command](commands.md#resources).
-### ValravnJsonResource
+## ValravnJsonResource
it's same as `JsonResource` class on laravel. to start using this, first you
need to create resource class which should see something like this.
@@ -37,7 +37,7 @@ You can specify the model's attributes in `extract` method that you wand to see
in response. the `type` method determines related entity on this response for
the front-end dev.
-### ValravnResourceCollection
+## ValravnResourceCollection
The resource collection class is the same as `ValravnJsonResource`.
@@ -58,7 +58,7 @@ class SampleCollection extends ValravnResourceCollection {
}
```
-## Available methods
+#### Available methods
Resource classes contain several methods and in continue, we will introduce them.
@@ -359,7 +359,7 @@ SampleResource::make($model)->withExampleInclude();
let's talk about how The front-end dev should work with defined includes. let's
assume we just want to include a relationship. all we need to do is this:
-```
+```plain
domain/api/namespace/name?includes=example
```
@@ -372,7 +372,7 @@ To eager load a relationship, you must pass the registered include using `includ
Valravn allows you to use nested eager loads. for that you just need to pass the
nested includes after the first one and split them using a `.` character.
-```
+```plain
domain/api/namespace/name?includes=example.owner
```
@@ -411,7 +411,7 @@ Columns you pass as parameter to actions, must be in filterable list of related
This action allows you just fetch columns that you want. it might help create
optimized requests.
-```
+```plain
domain/api/blog/posts?includes=comments:select(content).user:select(first_name|last_name)
```
@@ -425,7 +425,7 @@ doesn't resolve by ORM.
The `order` action ables you to set order for your relationship results.
-```
+```plain
domain/api/blog/posts?includes=comments:select(content):order(created_at)
```
@@ -434,7 +434,7 @@ domain/api/blog/posts?includes=comments:select(content):order(created_at)
Using this action, you can limit the number of rows must fetch from related
relationship.
-```
+```plain
domain/api/blog/categories?includes=posts:limit(5)
```
@@ -442,7 +442,7 @@ this request will return the categories while each category loaded with at least
5 related posts. however the `limit` action accepts two parameter. the second
parameter acts like page number.
-```
+```plain
domain/api/blog/categories?includes=posts:limit(5|2)
```
@@ -496,5 +496,3 @@ PostResource::make( $this->post )
]
)
```
-
-
diff --git a/docs/content/docs/Basics/services.md b/docs/content/docs/Basics/services.md
index 72010b9..3aa055e 100644
--- a/docs/content/docs/Basics/services.md
+++ b/docs/content/docs/Basics/services.md
@@ -5,7 +5,7 @@ weight: 2
Valravn has several services that each one has their own functionality.
-### Service contract
+## Service contract
Service classes must extend `Hans\Valravn\Services\Contracts\Service` class.
@@ -40,7 +40,7 @@ Sometimes you need to conditionally determine you want to use cache or not.
app( ExampleService::class )->cacheWhen( user()->isNotAdmin() )->calculatePopularExamples();
```
-### Caching logic
+## Caching logic
This service helps up caching data and retrieve them on next calls. the logic of
this service is a bit complicated but in the simplest way, it caches data and
@@ -70,7 +70,7 @@ use Hans\Valravn\Facades\Cache;
Cache::store( 'unique_key', fn() => 10 / 12 );
```
-### Notifiable
+## Notifiable
This contract let you have a notification for each action depending on model.
the notification contains a title, body and a related model.
@@ -79,7 +79,7 @@ the notification contains a title, body and a related model.
Notifications will not store in database.
{{< /tip >}}
-### FilteringService
+## FilteringService
The `FilteringService` allows us to apply some logics on query builder instance
through api calls.
@@ -226,7 +226,7 @@ domain/api/blog/posts/1/comments?or_where_relation_filter[comments->title]=somet
It's the same as `or_where_relation_filter` but this filter add a where like
condition instead of where.
-### RoutingService
+## RoutingService
This service helps you to define your routes. the `Hans\Valravn\Facades\Router`
facade is here to make it easy to use this service.
diff --git a/docs/content/docs/Basics/tests.md b/docs/content/docs/Basics/tests.md
index 36dc632..7cf88d8 100644
--- a/docs/content/docs/Basics/tests.md
+++ b/docs/content/docs/Basics/tests.md
@@ -5,7 +5,7 @@ weight: 2
For testing, there is some helpful methods that can be found so handy.
-### Available methods
+#### Available methods
{{< column "methods-container" >}}
@@ -71,7 +71,7 @@ public function example(): void {
}
```
-### Factory contract
+## Factory contract
This contract helps to create fake data for your test suite. the implementation class should be like this.
diff --git a/docs/themes/compose/assets/js/code.js b/docs/themes/compose/assets/js/code.js
index 578c311..c832670 100644
--- a/docs/themes/compose/assets/js/code.js
+++ b/docs/themes/compose/assets/js/code.js
@@ -6,7 +6,7 @@ const snippet_actions = [
show: true
},
{
- icon: 'order',
+ icon: 'toggle-line-numbers',
id: 'lines',
title: toggle_line_numbers_text,
show: true
diff --git a/docs/themes/compose/layouts/partials/sprites.html b/docs/themes/compose/layouts/partials/sprites.html
index 4dc23b1..0bd9e24 100644
--- a/docs/themes/compose/layouts/partials/sprites.html
+++ b/docs/themes/compose/layouts/partials/sprites.html
@@ -71,7 +71,7 @@
-
+
diff --git a/src/Commands/Relation.php b/src/Commands/Relation.php
index c574d4c..0c33369 100644
--- a/src/Commands/Relation.php
+++ b/src/Commands/Relation.php
@@ -41,7 +41,7 @@ class Relation extends Command
*
* @var string
*/
- protected $description = 'Generate store and update request classes.';
+ protected $description = 'Generate store and update request classes for a specific relationship.';
private Filesystem $fs;