summaryrefslogtreecommitdiff
path: root/src/Model
diff options
context:
space:
mode:
Diffstat (limited to 'src/Model')
-rw-r--r--src/Model/ScormModel.php6
-rw-r--r--src/Model/ScormScoModel.php11
2 files changed, 15 insertions, 2 deletions
diff --git a/src/Model/ScormModel.php b/src/Model/ScormModel.php
index d5c8499..1959be6 100644
--- a/src/Model/ScormModel.php
+++ b/src/Model/ScormModel.php
@@ -8,6 +8,12 @@ use Illuminate\Database\Eloquent\Model;
class ScormModel extends Model
{
+
+ public static function whereOriginFile($identifier)
+ {
+ return $this->where('origin_file', $identifier);
+ }
+
public function getTable()
{
return config('scorm.table_names.scorm_table', parent::getTable());
diff --git a/src/Model/ScormScoModel.php b/src/Model/ScormScoModel.php
index de50741..d606d32 100644
--- a/src/Model/ScormScoModel.php
+++ b/src/Model/ScormScoModel.php
@@ -13,11 +13,18 @@ class ScormScoModel extends Model
return config('scorm.table_names.scorm_sco_table', parent::getTable());
}
- public function scorm() {
+ public function scorm()
+ {
return $this->belongsTo(ScormModel::class, 'scorm_id', 'id');
}
- public function scoTrackings() {
+ public function scoTrackings()
+ {
return $this->hasMany(ScormScoTrackingModel::class, 'sco_id', 'id');
}
+
+ public function children()
+ {
+ return $this->hasMany(ScormScoModel::class, 'sco_parent_id', 'id');
+ }
}