Download the PHP package aurorawebsoftware/connective without Composer
On this page you can find all versions of the php package aurorawebsoftware/connective. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download aurorawebsoftware/connective
More information about aurorawebsoftware/connective
Files in aurorawebsoftware/connective
Package connective
Short Description This is my package connective
License MIT
Homepage https://github.com/aurorawebsoftware/connective
Informations about the package connective
Laravel Connective Package Documentation
Introduction
The Laravel Connective package provides a simple and intuitive way to establish connections between Eloquent models. It allows you to define different connection types and manage relationships between models.
Key Concepts
1. Connection Types
- Connection Types: The package supports multiple connection types, which are defined in the package configuration. Users can connect models using one of these types.
2. Models
- Connective Model: Any Eloquent model can be used with the Connective package. To enable the package's functionality, a model must implement the
ConnectiveContract
.
3. Connections
- Connection Model: The package utilizes a
Connection
model to represent the relationships between different models. Each connection has a type, source model, and target model.
Installation
To get started with the Laravel Connective package, follow these installation steps:
-
Install the package using Composer:
-
Publish the package configuration file:
- Update the connection types in the configuration file according to your needs.
Usage
Creating a Connective Model
To work with the Laravel Connective package, ensure that your models are set up correctly. Below are examples of how to create the necessary Eloquent models for the package:
Ensure that your models extend the appropriate Eloquent classes and implement the ConnectiveContract where necessary. Customize the models according to your application's requirements and business logic.
Here is the sample models
Establishing Connections between Models
To establish a connection between two models, you can use the connectTo
method:
connect user1 to user2 with friendship (make friend1 and firend2 be friend)
Connections are unidirectional; it is necessary to establish connections from each model if required.
Models can support multiple connection types and can accommodate multiple connections for the same model type.
Retrieving Connections
You can retrieve connections for a model using the connections
method. You can filter by connection type and target model type:
Retrieving Connected Models
To retrieve connected models (connective models) for a source model, you can use the connectives
method. You can filter by connection type and target model type:
Retrieve friends of the user
// Retrieve residences and offices of the user
Nested Connections
The package allows you to establish nested connections. For example, if Model A is connected to Model B, and Model B is connected to Model C, you can retrieve Model C from Model A through the connectives
method.
unlimited nesting
Conclusion
The Laravel Connective package simplifies managing relationships between Eloquent models by providing a straightforward and customizable solution. Explore the package's capabilities and tailor them to your project's needs.
This is a basic structure for your Laravel Connective package documentation. Be sure to expand and customize it further based on your package's specific features and requirements. Make sure to replace placeholder URLs and descriptions with actual content related to your package.
All versions of connective with dependencies
spatie/laravel-package-tools Version ^1.14.0
laravel/framework Version ^11.0