From e3e84353add6d83ca14e45d100755585a26f5382 Mon Sep 17 00:00:00 2001 From: lotyp Date: Thu, 14 Mar 2024 15:43:31 +0200 Subject: [PATCH 1/2] docs: configuration section, external links, icons --- README.md | 2 +- config/cycle.php | 12 ++--- docs/components/env-table/index.tsx | 46 +++++++++++++++++++ docs/components/env-table/style.module.css | 13 ++++++ docs/components/external-link/index.tsx | 13 ++++++ docs/package.json | 1 + docs/pages/configuration.mdx | 51 ++++++++++++++++++++++ docs/pages/contributing.mdx | 11 ++--- docs/pages/index.mdx | 36 +++++++-------- docs/pages/installation.mdx | 20 +++++---- docs/pages/services/factories.mdx | 6 +-- docs/pages/services/seeders.mdx | 4 +- docs/pages/services/testing.mdx | 10 ++--- docs/pages/services/validation.mdx | 4 +- docs/pages/usage/_meta.json | 3 ++ docs/pages/usage/annotations.mdx | 1 - docs/pages/usage/attributes.mdx | 1 + docs/pages/usage/entity-manager.mdx | 1 + docs/pnpm-lock.yaml | 11 +++++ docs/tailwind.config.js | 1 + docs/theme.config.tsx | 13 +++--- 21 files changed, 204 insertions(+), 56 deletions(-) create mode 100644 docs/components/env-table/index.tsx create mode 100644 docs/components/env-table/style.module.css create mode 100644 docs/components/external-link/index.tsx create mode 100644 docs/pages/usage/_meta.json delete mode 100644 docs/pages/usage/annotations.mdx create mode 100644 docs/pages/usage/attributes.mdx diff --git a/README.md b/README.md index 7751e8ea..6c021580 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ The full documentation for the package is available at [https://laravel-cycle-or
-## 🤝 Contributing +## 📥 Contributing Contributions are welcome! diff --git a/config/cycle.php b/config/cycle.php index 1ed7178a..6d809e9d 100644 --- a/config/cycle.php +++ b/config/cycle.php @@ -159,12 +159,12 @@ * Use any of channels configured in your logging.php file */ 'logger' => [ - 'default' => env('DB_DEFAULT_LOGGER_CHANNEL', null), + 'default' => env('DB_DEFAULT_LOGGER', null), 'drivers' => [ - 'sqlite' => env('DB_DEFAULT_LOGGER_CHANNEL', null), - 'pgsql' => env('DB_DEFAULT_LOGGER_CHANNEL', null), - 'mysql' => env('DB_DEFAULT_LOGGER_CHANNEL', null), - 'sqlserver' => env('DB_DEFAULT_LOGGER_CHANNEL', null), + 'sqlite' => env('DB_DEFAULT_LOGGER', null), + 'pgsql' => env('DB_DEFAULT_LOGGER', null), + 'mysql' => env('DB_DEFAULT_LOGGER', null), + 'sqlserver' => env('DB_DEFAULT_LOGGER', null), ], ], ], @@ -272,6 +272,6 @@ * @see https://github.com/cycle/entity-behavior */ 'entityBehavior' => [ - 'register' => true, + 'register' => env('CYCLE_REGISTER_ENTITY_BEHAVIOUR', true), ], ]; diff --git a/docs/components/env-table/index.tsx b/docs/components/env-table/index.tsx new file mode 100644 index 00000000..ffb9c0b7 --- /dev/null +++ b/docs/components/env-table/index.tsx @@ -0,0 +1,46 @@ +import styles from './style.module.css' + +export function OptionTable({ options }: { options: [string, string, string, string][] }) { + const createMarkup = (htmlContent) => { + return { __html: htmlContent }; + }; + + return ( +
+ + + + + + + + + + + {options.map(([variable, values, defaultValue, description]) => ( + + + + + + + ))} + +
Environment VariableAvailable ValuesDefaultDescription
+ {variable} + + {values} + + {defaultValue} +
+
+ ) +} diff --git a/docs/components/env-table/style.module.css b/docs/components/env-table/style.module.css new file mode 100644 index 00000000..736d0a6c --- /dev/null +++ b/docs/components/env-table/style.module.css @@ -0,0 +1,13 @@ +.container { + mask-image: linear-gradient( + to right, + transparent 0.8em, + white 1.5em, + white calc(100% - 1.5em), + transparent calc(100% - 0.8em) + ); +} + +.container::-webkit-scrollbar { + appearance: none; +} diff --git a/docs/components/external-link/index.tsx b/docs/components/external-link/index.tsx new file mode 100644 index 00000000..e1c52f05 --- /dev/null +++ b/docs/components/external-link/index.tsx @@ -0,0 +1,13 @@ +import React from 'react'; +import { ArrowTopRightOnSquareIcon } from "@heroicons/react/20/solid"; + +const ExternalLink = ({ href, children }) => { + return ( + + {children} + + + ); +}; + +export default ExternalLink; diff --git a/docs/package.json b/docs/package.json index f5323376..07417488 100644 --- a/docs/package.json +++ b/docs/package.json @@ -19,6 +19,7 @@ }, "homepage": "https://github.com/shuding/nextra-docs-template#readme", "dependencies": { + "@heroicons/react": "^2.1.1", "@vercel/analytics": "^1.2.2", "next": "^14.1.3", "nextra": "latest", diff --git a/docs/pages/configuration.mdx b/docs/pages/configuration.mdx index a025a48b..d72e7b38 100644 --- a/docs/pages/configuration.mdx +++ b/docs/pages/configuration.mdx @@ -1 +1,52 @@ +import { + Callout +} from "nextra-theme-docs"; +import {OptionTable} from "../components/env-table"; + # Configuration + +This section guides you through configuring the Laravel-CycleORM-Adapter package within your Laravel application. Configuration settings are managed in the `config/cycle.php` file. Ensure you have this file in your project by following the steps outlined in the [Installation](/installation) guide. + +## 🌎 Environment Variables + +### Database Connection Variables + +This section details the environment variables for database connections. Our package uses Laravel's standard variables and introduces additional settings for CycleORM integration. Configure these in your `.env` file as needed or override them in your `config/cycle.php` file. + +These are variables, that will be in `.env` file of your Laravel project from the box, and are used by `config/cycle.php` to configure CycleORM. + + + +### Additional Variables + +These variables offer further customization for CycleORM's operation within Laravel. + + + Add these manually in your `.env` file to modify default behaviors, or use the `config/cycle.php` file to override them. + + +cycle/entity-behavior"] + ]} +/> diff --git a/docs/pages/contributing.mdx b/docs/pages/contributing.mdx index da40b84f..ab170e3d 100644 --- a/docs/pages/contributing.mdx +++ b/docs/pages/contributing.mdx @@ -1,4 +1,5 @@ import { Callout } from 'nextra-theme-docs' +import ExternalLink from "../components/external-link"; # Contributing @@ -28,8 +29,8 @@ The latest changes are always in master branch, so please make your Pull Request ## ✉️ Git Message Format -This repo adheres to the [Conventional Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification. -Commit messages are enforced through [commitizen](https://github.com/commitizen-tools/commitizen) and a [pre-commit](https://pre-commit.com), please use `make hooks` to install them. +This repo adheres to the Conventional Commits specification. +Commit messages are enforced through commitizen and a pre-commit, please use `make hooks` to install them. This leads to more readable messages that are easy to follow when looking through the project history and also allows to generate changelogs automatically. @@ -61,7 +62,7 @@ $ make test ### → Static Analysis -Run Code quality checks using [PHPStan](https://phpstan.org): +Run Code quality checks using PHPStan: ```bash $ make lint-stan @@ -69,7 +70,7 @@ $ make lint-stan ### → Coding Standards Fixing -Fix code using [The PHP Coding Standards Fixer](https://github.com/wayofdev/php-cs-fixer-config) to follow our standards: +Fix code using The PHP Coding Standards Fixer to follow our standards: ```bash $ make lint-php @@ -81,4 +82,4 @@ If you discover a security vulnerability within this package, please send an e-m ## 🤝 Code of Conduct -We are using the [Contributor Covenant](https://www.contributor-covenant.org/) as our Code of Conduct, to keep discussion open and inclusive. Please, take a moment to read and follow our [Code of Conduct](https://github.com/wayofdev/laravel-cycle-orm-adapter/blob/master/.github/CODE_OF_CONDUCT.md). +We are using the Contributor Covenant as our Code of Conduct, to keep discussion open and inclusive. Please, take a moment to read and follow our Code of Conduct. diff --git a/docs/pages/index.mdx b/docs/pages/index.mdx index fe8e4149..b8d5b7aa 100644 --- a/docs/pages/index.mdx +++ b/docs/pages/index.mdx @@ -1,8 +1,10 @@ +import ExternalLink from "../components/external-link"; + # Introduction -Unlock the full potential of [Domain-Driven Design](https://en.wikipedia.org/wiki/Domain-driven_design) in your Laravel projects with the [wayofdev/laravel-cycle-orm-adapter](https://github.com/wayofdev/laravel-cycle-orm-adapter) — the adapter package that seamlessly integrates the capabilities of [CycleORM](https://cycle-orm.dev) — DataMapper ORM into [Laravel Framework](https://laravel.com). +Unlock the full potential of Domain-Driven Design in your Laravel projects with the laravel-cycle-orm-adapter — the adapter package that seamlessly integrates the capabilities of CycleORM — DataMapper ORM into Laravel Framework. -This adapter bridges the gap between Laravel's rapid development capabilities and Cycle ORM's Data Mapper features, enabling you to craft complex, domain-centric applications, with separation of concerns, and a clear distinction between the domain model and the persistence layer. +This adapter bridges the gap between Laravel's rapid development capabilities and CycleORM's Data Mapper features, enabling you to craft complex, domain-centric applications, with separation of concerns, and a clear distinction between the domain model and the persistence layer. ## 🧐 Understanding the Limitations of Eloquent @@ -19,15 +21,15 @@ The Active Record pattern tightly couples domain logic and data persistence with There were many attempts to bring DDD to Laravel: -* [Laravel Beyond CRUD approach](https://laravel-beyond-crud.com) by Spatie +* Laravel Beyond CRUD approach by Spatie -* [Conciliating Laravel and DDD](https://lorisleiva.com/conciliating-laravel-and-ddd) by Loris Leiva +* Conciliating Laravel and DDD by Loris Leiva -* [Yet another Laravel 10 DDD interpretation](https://github.com/Orphail/laravel-ddd) +* Yet another Laravel 10 DDD interpretation these often involve workarounds to adapt Eloquent rather than a fundamental shift in approach. -The `laravel-cycle-orm-adapter` bridges this gap, by introducing DataMapper pattern capabilities to Laravel, empowering you to unlock the full potential of DDD within your projects. +The laravel-cycle-orm-adapter bridges this gap, by introducing DataMapper pattern capabilities to Laravel, empowering you to unlock the full potential of DDD within your projects. Here's why this combination shines: @@ -40,20 +42,20 @@ Here's why this combination shines: ## 🚀 Features -### Laravel Cycle ORM Adapter Features -- **Seamless Integration**: The adapter is designed to work seamlessly with Laravel, allowing you to use Cycle ORM in your Laravel projects without any hassle. +### Laravel CycleORM Adapter Features +- **Seamless Integration**: The adapter is designed to work seamlessly with Laravel, allowing you to use CycleORM in your Laravel projects without any hassle. - **Entity as Source of Truth for Database Migrations**: The adapter allows you to use your domain entities as the source of truth for your database schema, making it easier to keep your database schema in sync with your domain model. -- **Laravel Collections Support**: The adapter provides support for [Laravel Collections](https://laravel.com/docs/10.x/collections), allowing you to use them with your domain models and repositories -- **Database Factories**: Use Laravel database seeders together with CycleORM Entity Factories via [wayofdev/laravel-cycle-orm-factories](https://github.com/wayofdev/laravel-cycle-orm-factories) -- **Real Repositories**: [Avoid breaking the Repository Design Pattern in Laravel](https://medium.com/@sergiumneagu/laravel-why-youve-been-using-the-repository-pattern-the-wrong-way-952aedf1989b), maintaining a clear separation between your domain logic and the persistence layer. +- **Laravel Collections Support**: The adapter provides support for Laravel Collections, allowing you to use them with your domain models and repositories +- **Database Factories**: Use Laravel database seeders together with CycleORM Entity Factories via wayofdev/laravel-cycle-orm-factories +- **Real Repositories**: Avoid breaking the Repository Design Pattern in Laravel, maintaining a clear separation between your domain logic and the persistence layer. -### Cycle ORM Features -- **Domain-Driven Design**: Cycle ORM is designed to work with complex domain models, making it a perfect fit for DDD. -- **Data Mapper**: Cycle ORM is a Data Mapper ORM, which means that it allows you to define your domain models and their relationships in a way that is more natural and expressive. -- **Powerful Query Builder**: Cycle ORM provides a powerful query builder that allows you to write complex queries in a way that is easy to read and understand. -- **Schema Management**: Cycle ORM provides powerful schema management capabilities, allowing you to define your database schema using PHP code. +### CycleORM Features +- **Domain-Driven Design**: CycleORM is designed to work with complex domain models, making it a perfect fit for DDD. +- **Data Mapper**: CycleORM is a Data Mapper ORM, which means that it allows you to define your domain models and their relationships in a way that is more natural and expressive. +- **Powerful Query Builder**: CycleORM provides a powerful query builder that allows you to write complex queries in a way that is easy to read and understand. +- **Schema Management**: CycleORM provides powerful schema management capabilities, allowing you to define your database schema using PHP code. ## 🛠️ Want to see it in action? -Explore the Laravel CycleORM Starter Kit project: [laravel-cycle-orm-starter-kit](https://github.com/wayofdev/laravel-cycle-starter-tpl), based on Laravel 10.x. It showcases the practical use of the adapter in a real-world application, demonstrating how to leverage CycleORM's strengths within a Laravel project. +Explore the Laravel CycleORM Starter Kit project: laravel-cycle-orm-starter-kit, based on Laravel 10.x. It showcases the practical use of the adapter in a real-world application, demonstrating how to leverage CycleORM's strengths within a Laravel project. diff --git a/docs/pages/installation.mdx b/docs/pages/installation.mdx index f72fb3dd..5956e2d5 100644 --- a/docs/pages/installation.mdx +++ b/docs/pages/installation.mdx @@ -1,6 +1,8 @@ +import ExternalLink from "../components/external-link"; + # Installation -Welcome to the installation guide for the Laravel Cycle ORM Adapter. This document will walk you through the setup process to get you up and running quickly. +Welcome to the installation guide for the Laravel CycleORM Adapter. This document will walk you through the setup process to get you up and running quickly. ## 🚩 Prerequisites @@ -11,15 +13,15 @@ Before you begin, ensure your development environment meets the following requir ## 🧩 Compatibility Map -| Laravel | Cycle ORM | Adapter | -|---------|-----------|---------| -| ^10.28 | 2.x | 4.x | -| 11.x | 2.x | ^4.9.0 | +| Laravel | CycleORM | Adapter | +|---------|----------|---------| +| ^10.28 | 2.x | 4.x | +| 11.x | 2.x | ^4.9.0 | ## 🚀 Quick Start -Installing the Laravel Cycle ORM Adapter is straightforward with Composer. Follow the steps below to add the adapter to your Laravel project. +Installing the Laravel CycleORM Adapter is straightforward with Composer. Follow the steps below to add the adapter to your Laravel project.
@@ -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..7edab59e 100644 --- a/docs/pages/services/factories.mdx +++ b/docs/pages/services/factories.mdx @@ -1,10 +1,10 @@ import { Callout } from "nextra-theme-docs"; -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](https://laravel.com/docs/10.x/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](https://github.com/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. diff --git a/docs/pages/services/seeders.mdx b/docs/pages/services/seeders.mdx index 6375f756..4f317924 100644 --- a/docs/pages/services/seeders.mdx +++ b/docs/pages/services/seeders.mdx @@ -1,6 +1,6 @@ import {Callout} from "nextra-theme-docs"; -## 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. @@ -42,7 +42,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..ee25186f 100644 --- a/docs/pages/services/testing.mdx +++ b/docs/pages/services/testing.mdx @@ -1,6 +1,6 @@ import {Callout} from "nextra-theme-docs"; -## 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. @@ -8,14 +8,14 @@ Adapter package provides a set of modified Laravel testing traits and methods to Check also [Laravel Database Testing](https://laravel.com/docs/10.x/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 +35,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 +75,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 526416ae..98800d54 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 From e213bf99e61856da122e7e30efcb263baa278b7d Mon Sep 17 00:00:00 2001 From: lotyp Date: Thu, 14 Mar 2024 15:47:58 +0200 Subject: [PATCH 2/2] docs: mark external links with icon --- docs/pages/services/factories.mdx | 9 +++++---- docs/pages/services/seeders.mdx | 5 +++-- docs/pages/services/testing.mdx | 3 ++- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/docs/pages/services/factories.mdx b/docs/pages/services/factories.mdx index 7edab59e..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"; ## 🗒️ Introduction -Like [Eloquent Factories](https://laravel.com/docs/10.x/eloquent-factories) this package enables you to define factories for your entities, integrating CycleORM with Laravel's elegant syntax and functionality. +Like Eloquent Factories this package enables you to define factories for your entities, integrating CycleORM with Laravel's elegant syntax and functionality. -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. +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 4f317924..7359e2a6 100644 --- a/docs/pages/services/seeders.mdx +++ b/docs/pages/services/seeders.mdx @@ -1,4 +1,5 @@ import {Callout} from "nextra-theme-docs"; +import ExternalLink from "../../components/external-link"; ## 🗒️ Introduction @@ -6,7 +7,7 @@ Laravel includes the ability to seed your database with data using seed classes. 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. diff --git a/docs/pages/services/testing.mdx b/docs/pages/services/testing.mdx index ee25186f..5132444b 100644 --- a/docs/pages/services/testing.mdx +++ b/docs/pages/services/testing.mdx @@ -1,11 +1,12 @@ import {Callout} from "nextra-theme-docs"; +import ExternalLink from "../../components/external-link"; ## 🗒️ 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