@@ -31,7 +33,7 @@ For the core functionality, run the following Composer command in your terminal:
$ composer req wayofdev/laravel-cycle-orm-adapter
```
-This command installs the wayofdev/laravel-cycle-orm-adapter package, integrating Cycle ORM into your Laravel application.
+This command installs the wayofdev/laravel-cycle-orm-adapter package, integrating CycleORM into your Laravel application.
### Step: Publish Configuration
@@ -46,10 +48,10 @@ $ php artisan vendor:publish \
## 🏭 Database Factories (Optional)
-If you need support for [Eloquent-like Factories](https://laravel.com/docs/10.x/eloquent-factories), install the following package:
+If you need support for
Eloquent-like Factories, install the following package:
```bash
$ composer req --dev wayofdev/laravel-cycle-orm-factories
```
-which will install the [wayofdev/laravel-cycle-orm-factories](https://github.com/wayofdev/laravel-cycle-orm-factories) package to provide similar functionality
+which will install the
wayofdev/laravel-cycle-orm-factories package to provide similar functionality
diff --git a/docs/pages/services/factories.mdx b/docs/pages/services/factories.mdx
index 69884f71..a41fd92a 100644
--- a/docs/pages/services/factories.mdx
+++ b/docs/pages/services/factories.mdx
@@ -1,10 +1,11 @@
import { Callout } from "nextra-theme-docs";
+import ExternalLink from "../../components/external-link";
-Like [Eloquent Factories](https://laravel.com/docs/10.x/eloquent-factories) this package enables you to define factories for your entities, integrating Cycle ORM with Laravel's elegant syntax and functionality.
+## 🗒️ Introduction
-This feature is available through the [wayofdev/laravel-cycle-orm-factories](https://github.com/wayofdev/laravel-cycle-orm-factories), be sure to check [installation](/installation#-database-factories-optional) instructions.
+Like
Eloquent Factories this package enables you to define factories for your entities, integrating CycleORM with Laravel's elegant syntax and functionality.
-## 📝 Introduction
+This feature is available through the
wayofdev/laravel-cycle-orm-factories, be sure to check [installation](/installation#-database-factories-optional) instructions.
When testing your application or seeding your database, you may need to insert a few records into your database. Instead of manually specifying the value of each column, this package, same as Laravel, allows you to define a set of default attributes for each of your [Entities](/usage/entities) using factory classes.
@@ -59,7 +60,7 @@ Factory classes should implement:
* `makeEntity` (optional) — method allows you to control the process of creating an entity through its constructor. The method takes an array of definitions as an argument, which is generated by the `definition` method.
-Use the `definition` method to specify properties, utilizing the [Faker](https://fakerphp.github.io) library, which provides a wide range of fake data generation methods such as names, addresses, phone numbers, etc.
+Use the `definition` method to specify properties, utilizing the
Faker library, which provides a wide range of fake data generation methods such as names, addresses, phone numbers, etc.
## ⚡️ Creating Entities using Factories
@@ -202,7 +203,7 @@ class PostFactory extends AbstractFactory
In addition to the state method, there also the entityState method. This method allows developers to change the state of an entity object using the available methods of that entity. It takes a closure as an argument, which should accept the entity as an argument and should return the modified entity. This allows developers to take full advantage of the object-oriented nature of their entities and use the methods that are already defined on the entity to change its state.
-Can also be used in same manner as [Laravel trashed states](https://laravel.com/docs/10.x/eloquent-factories#trashed-state)
+Can also be used in same manner as
Laravel trashed states
```php
diff --git a/docs/pages/services/seeders.mdx b/docs/pages/services/seeders.mdx
index 6375f756..7359e2a6 100644
--- a/docs/pages/services/seeders.mdx
+++ b/docs/pages/services/seeders.mdx
@@ -1,12 +1,13 @@
import {Callout} from "nextra-theme-docs";
+import ExternalLink from "../../components/external-link";
-## Introduction
+## 🗒️ Introduction
Laravel includes the ability to seed your database with data using seed classes. All seed classes are stored in the database/seeders directory.
Same as in Laravel with Eloquent, you can use default Laravel seeders to seed your data into the database, by using CycleORM database factories.
-Check also [Laravel Database Seeders](https://laravel.com/docs/10.x/seeding) documentation.
+Check also Laravel Database Seeders documentation.
## ✏️ Writing Seeders
@@ -19,7 +20,7 @@ php artisan make:seeder PostSeeder
## ⚡️ Using Entity Factories
-Best way to use seeders is to use Entity Factories, which is provided by [wayofdev/laravel-cycle-orm-factories](https://github.com/wayofdev/laravel-cycle-orm-factories). You can create a factory for each of your entities and use them to seed your database.
+Best way to use seeders is to use Entity Factories, which is provided by
wayofdev/laravel-cycle-orm-factories. You can create a factory for each of your entities and use them to seed your database.
In this documentation section we will use examples from [Factories](/services/factories) documentation page.
@@ -42,7 +43,7 @@ final class PostSeeder extends Seeder
$author = UserFactory::new()->createOne();
$posts = PostFactory::new()->withUser($author)->times(20)->create();
- $collection->each(function (Post $post): void {
+ $posts->each(function (Post $post): void {
CommentFactory::new([
'post' => $post,
])->times(10)->create();
diff --git a/docs/pages/services/testing.mdx b/docs/pages/services/testing.mdx
index 0ca8ccf8..5132444b 100644
--- a/docs/pages/services/testing.mdx
+++ b/docs/pages/services/testing.mdx
@@ -1,21 +1,22 @@
import {Callout} from "nextra-theme-docs";
+import ExternalLink from "../../components/external-link";
-## Introduction
+## 🗒️ Introduction
Adapter package provides a set of modified Laravel testing traits and methods to make testing easier, and as close as possible to native Laravel Testing methods, when using CycleORM.
- Check also [Laravel Database Testing](https://laravel.com/docs/10.x/database-testing) documentation.
+ Check also Laravel Database Testing documentation.
-## Resetting the Database After Each Test
+## 🗑️ Resetting the Database After Each Test
@todo This trait is not yet implemented as native adapter functionality.
Currently, you can use default `Illuminate\Foundation\Testing\RefreshDatabase` trait to reset the database after each test. It will use the default Laravel database connection to reset the database.
-## Entity Factories
+## 🏭 Entity Factories
When testing, you may need to insert a few records into your database before executing your test. Instead of manually specifying the value of each column when you create this test data, Adapter package allows you to define a set of default attributes for each of your CycleORM [Entities](/usage/entities) using [Entity Factories](/services/factories).
@@ -35,7 +36,7 @@ public function it_creates_post_entity_and_persists_it(): void
}
```
-## Running Seeders
+## 👟 Running Seeders
If you would like to use [database seeders](/services/seeders) to populate your database during a feature test, you may invoke the `seed` method. By default, the `seed` method will execute the `DatabaseSeeder`, which should execute all of your other seeders. Alternatively, you pass a specific seeder class name to the `seed` method:
@@ -75,7 +76,7 @@ class ExampleTest extends TestCase
}
```
-## Available Assertions
+## 🔍 Available Assertions
This adapter package overrides Laravel's assertion methods to make them work with CycleORM entities. Use `WayOfDev\Cycle\Testing\Concerns\InteractsWithDatabase` trait in your base test case or in test cases where it is needed, instead of default Laravel `InteractsWithDatabase` trait.
diff --git a/docs/pages/services/validation.mdx b/docs/pages/services/validation.mdx
index cf59c592..c1356137 100644
--- a/docs/pages/services/validation.mdx
+++ b/docs/pages/services/validation.mdx
@@ -1,6 +1,8 @@
+import ExternalLink from "../../components/external-link";
+
# Validation
-Laravel provides several different approaches to validate your application's incoming data. As we plan to use this package in larger projects, better approach would be to use Laravel [Form Request Validation](https://laravel.com/docs/10.x/validation#form-request-validation). This way we can keep our controllers clean and our code more readable.
+Laravel provides several different approaches to validate your application's incoming data. As we plan to use this package in larger projects, better approach would be to use Laravel
Form Request Validation. This way we can keep our controllers clean and our code more readable.
Both `unique` and `exists` validation rules, require the database to be queried. This packages provides this integration.
diff --git a/docs/pages/usage/_meta.json b/docs/pages/usage/_meta.json
new file mode 100644
index 00000000..5623ceb6
--- /dev/null
+++ b/docs/pages/usage/_meta.json
@@ -0,0 +1,3 @@
+{
+ "attributes": "Attributes (Annotations)"
+}
diff --git a/docs/pages/usage/annotations.mdx b/docs/pages/usage/annotations.mdx
deleted file mode 100644
index 7ce7b975..00000000
--- a/docs/pages/usage/annotations.mdx
+++ /dev/null
@@ -1 +0,0 @@
-# Annotations (Attributes)
diff --git a/docs/pages/usage/attributes.mdx b/docs/pages/usage/attributes.mdx
new file mode 100644
index 00000000..d61c6d50
--- /dev/null
+++ b/docs/pages/usage/attributes.mdx
@@ -0,0 +1 @@
+# Attributes (Annotations)
diff --git a/docs/pages/usage/entity-manager.mdx b/docs/pages/usage/entity-manager.mdx
index e69de29b..f2fc29d3 100644
--- a/docs/pages/usage/entity-manager.mdx
+++ b/docs/pages/usage/entity-manager.mdx
@@ -0,0 +1 @@
+# Entity Manager
diff --git a/docs/pnpm-lock.yaml b/docs/pnpm-lock.yaml
index 728f39fa..6a3a2bc4 100644
--- a/docs/pnpm-lock.yaml
+++ b/docs/pnpm-lock.yaml
@@ -5,6 +5,9 @@ settings:
excludeLinksFromLockfile: false
dependencies:
+ '@heroicons/react':
+ specifier: ^2.1.1
+ version: 2.1.1(react@18.2.0)
'@vercel/analytics':
specifier: ^1.2.2
version: 1.2.2(next@14.1.3)(react@18.2.0)
@@ -72,6 +75,14 @@ packages:
react-dom: 18.2.0(react@18.2.0)
dev: false
+ /@heroicons/react@2.1.1(react@18.2.0):
+ resolution: {integrity: sha512-JyyN9Lo66kirbCMuMMRPtJxtKJoIsXKS569ebHGGRKbl8s4CtUfLnyKJxteA+vIKySocO4s1SkTkGS4xtG/yEA==}
+ peerDependencies:
+ react: '>= 16'
+ dependencies:
+ react: 18.2.0
+ dev: false
+
/@isaacs/cliui@8.0.2:
resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
engines: {node: '>=12'}
diff --git a/docs/tailwind.config.js b/docs/tailwind.config.js
index 636b29cf..80b96f24 100644
--- a/docs/tailwind.config.js
+++ b/docs/tailwind.config.js
@@ -3,6 +3,7 @@ module.exports = {
content: [
'./pages/**/*.{js,jsx,ts,tsx,md,mdx}',
'./components/**/*.{js,jsx,ts,tsx,md,mdx}',
+ './theme.config.tsx'
],
theme: {
extend: {},
diff --git a/docs/theme.config.tsx b/docs/theme.config.tsx
index 5be839d1..5c451222 100644
--- a/docs/theme.config.tsx
+++ b/docs/theme.config.tsx
@@ -9,10 +9,7 @@ const Logo = () => {
x="0px" y="0px" xmlSpace="preserve"
viewBox="881.02 445.23 157.96 189.54">
{
x="0px" y="0px" xmlSpace="preserve"
viewBox="881.02 445.23 157.96 189.54">
{
);
}
-
const config: DocsThemeConfig = {
logo: Logo,
project:
@@ -66,6 +62,11 @@ const config: DocsThemeConfig = {
text: 'Laravel CycleORM Adapter Documentation',
}
,
+ useNextSeoProps() {
+ return {
+ titleTemplate: '%s – Laravel-CycleORM-Adapter',
+ }
+ }
}
export default config