diff options
author | Devian Leong <devianleong@gmail.com> | 2022-03-22 09:13:10 +0800 |
---|---|---|
committer | Devian Leong <devianleong@gmail.com> | 2022-03-22 09:13:10 +0800 |
commit | 54d511f811ec3881bee4b6685e6a10b79ec3b13a (patch) | |
tree | db5fda54c3993b18fe9aa1316267467de6460b6e | |
parent | b415779ef32f8fead683eac2f558e6b162bc7dff (diff) |
Added resource morphs nullable. This will give the flexibility for developer to embed to model or simply upload and store.3.0.6
-rw-r--r-- | database/migrations/create_scorm_tables.php.stub | 2 | ||||
-rw-r--r-- | src/Model/ScormModel.php | 19 |
2 files changed, 20 insertions, 1 deletions
diff --git a/database/migrations/create_scorm_tables.php.stub b/database/migrations/create_scorm_tables.php.stub index cc9dc38..496aca4 100644 --- a/database/migrations/create_scorm_tables.php.stub +++ b/database/migrations/create_scorm_tables.php.stub @@ -22,7 +22,7 @@ class CreateScormTables extends Migration // scorm_model Schema::create($tableNames['scorm_table'], function (Blueprint $table) { $table->bigIncrements('id'); - $table->morphs('resource'); + $table->nullableMorphs('resource'); $table->string('title'); $table->string('origin_file')->nullable(); $table->string('version'); diff --git a/src/Model/ScormModel.php b/src/Model/ScormModel.php index d9ae680..35b2d4e 100644 --- a/src/Model/ScormModel.php +++ b/src/Model/ScormModel.php @@ -10,6 +10,25 @@ class ScormModel extends Model { /** + * The attributes that are mass assignable. + * + * @var array + */ + protected $fillable = [ + 'id', + 'resource_id', + 'resource_type', + 'title', + 'origin_file', + 'version', + 'ratio', + 'uuid', + 'entry_url', + 'created_at', + 'updated_at', + ]; + + /** * Get the parent resource model (user or post). */ public function resourceable() |