Download the PHP package ankurk91/laravel-eloquent-relationships without Composer
On this page you can find all versions of the php package ankurk91/laravel-eloquent-relationships. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ankurk91/laravel-eloquent-relationships
More information about ankurk91/laravel-eloquent-relationships
Files in ankurk91/laravel-eloquent-relationships
Package laravel-eloquent-relationships
Short Description Add missing eloquent relationships to Laravel php framework.
License MIT
Homepage https://github.com/ankurk91/laravel-eloquent-relationships
Informations about the package laravel-eloquent-relationships
Missing Eloquent Relationships For Laravel
This package adds some missing relationships to Eloquent in Laravel
Installation
You can install the package via composer:
Usage
BelongsToOne
BelongsToOne relation is almost identical to
standard BelongsToMany except it returns one model
instead of Collection of models and null
if there is no related model in DB (BelongsToMany returns empty Collection in
this case). Example:
Now you can access the relationship like:
MorphToOne
MorphToOne relation is almost identical to
standard MorphToMany except it
returns one model instead of Collection of models and null
if there is no related model in DB (MorphToMany returns
empty Collection in this case). Example:
Now you can access the relationship like:
Testing
Security
If you discover any security issues, please email pro.ankurk1[at]gmail[dot]com
instead of using the issue tracker.
Attribution
- Most of the code is taken from this PR
- Similar package fidum/laravel-eloquent-morph-to-one
License
The MIT License.
All versions of laravel-eloquent-relationships with dependencies
illuminate/database Version ^9.34 || ^10 || ^11
illuminate/support Version ^9.34 || ^10 || ^11