summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKhaled Lela <eng.khaled.lela@gmail.com>2022-02-11 20:46:50 +0200
committerKhaled Lela <eng.khaled.lela@gmail.com>2022-02-11 20:46:50 +0200
commit3bbb54762498dbb149e6e4df221b940d7cd947bb (patch)
tree2a2a9fc8f590791f5e3563da9f2be928810f9fa7
parent616c2bc6baab2a72fc516abd8e7f1fc1dec1b56b (diff)
parentad4a8ecc7e5613418a5dfddf83fe392492a69559 (diff)
Merge branch 'laravel_builder_dynamic_where' into main
-rw-r--r--src/Manager/ScormManager.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/Manager/ScormManager.php b/src/Manager/ScormManager.php
index 56c723c..935bb2d 100644
--- a/src/Manager/ScormManager.php
+++ b/src/Manager/ScormManager.php
@@ -60,6 +60,31 @@ class ScormManager
throw new InvalidScormArchiveException('invalid_scorm_data');
}
+ /**
+ * ScormModel::whereOriginFile Query Builder style equals ScormModel::where('origin_file',$value)
+ *
+ * From Laravel doc https://laravel.com/docs/5.0/queries#advanced-wheres.
+ * Dynamic Where Clauses
+ * You may even use "dynamic" where statements to fluently build where statements using magic methods:
+ *
+ * Examples:
+ *
+ * $admin = DB::table('users')->whereId(1)->first();
+ *
+ * $john = DB::table('users')
+ * ->whereIdAndEmail(2, 'john@doe.com')
+ * ->first();
+ *
+ * $jane = DB::table('users')
+ * ->whereNameOrAge('Jane', 22)
+ * ->first();
+ *
+ *
+ * From laravel framework https://github.com/laravel/framework/blob/9.x/src/Illuminate/Database/Query/Builder.php'
+ *
+ * Handle dynamic method calls into the method.
+ * return $this->dynamicWhere($method, $parameters);
+ **/
$scorm = ScormModel::whereOriginFile($scormData['identifier']);
// Check if scom package already exists to drop old one.
if (!$scorm->exists()) {