salvatorecervone/relationsjoins

This is my package relationsjoins

v0.3 2023-08-19 04:52 UTC

README

Latest Version on Packagist Tests Total Downloads

Whats?

This package help you to convert relationship eloquent to join relation

Installation

You can install the package via composer:

composer require salvatorecervone/relationsjoins

Usage

For start you setting type of your relation for all relation do you use ex.

function role(): HasMany
{
    return $this->hasMany(Role::class);
}

Use Triat in any models do you return joins with

Use ReturnJoin;

and after you call one row of code

$joins = app('App\Models\User')->load['role']->returnjoin(); 

the result is a array with all information of all relations usage. The array have all id and name table for real relation and have the inner join string for usage in query builder

Credits

License

The MIT License (MIT). Please see License File for more information.