This repository was archived by the owner on May 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
feat: Improve the ORM #1
Copy link
Copy link
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
The ORM don't permit to do some operations (will be describe below) directly in the database.
It's will be useful and better to be able to do it. Solve this problem, will also permit to replace the usage of special attributes who was a short-term solution.
Example
Count a set of objects
Before
count($question->answers);Expected
$question->answers->count();Verify if a set of objects exists
Before
if (count($question->answers)) {
...
}Expected
if ($question->answers->exists()) {
...
}Delete a set of objects
Before
foreach ($question->answers as $answer) {
$answer->delete();
}Expected
$question->answers->delete();Order a set of objects
Before
function score($quiz)
{
return $quiz->score;
}
array_filter($user->quizzes, "score")Expected
$user->quizzes->orderBy("score");Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request