Skip to content
This repository has been archived by the owner on Sep 3, 2024. It is now read-only.

readme update #4

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@

**DISCLAIMER : ELOQUENT FUNCTIONS OF THIS PACKAGE WILL BREAK EAGERLOADING OF BELONGSTOMANY RELATIONSHIPS**

*This package is not compatible with belongsToMany relationships due to the indexation of entries. It is recommended not to use this package until I submit a solution to index collections properly*


## Utility classes for Laravel >= 5.8
### Highest Laravel compatibily tested as of this readme : 7.9.2

Expand Down Expand Up @@ -37,6 +43,11 @@ Base Model class offers:

<br>Collection as results of queries on a Model return an instance of `khwadj\Eloquent\Collection` that is indexed by primary key

**CAREFUL : THIS WILL BREAK EAGERLOADING OF BELONGSTOMANY RELATIONSHIPS**

*This package is not compatible with belongsToMany relationships due to the indexation of entries. It is recommended not to use this package until I submit a solution to index collections properly*


```
$models = MyModel::all();
// get the model with primary key = 1
Expand Down
2 changes: 1 addition & 1 deletion src/Eloquent/Collection.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function add($item, $key = NULL)
if ( $item instanceof Model ) $key = $item->getKey();
}

if ( $key ) $this->items[$key] = $item;
if ( $key !== NULL ) $this->items[$key] = $item;
else $this->items[] = $item;

return $this;
Expand Down