summaryrefslogtreecommitdiff
path: root/src/Model/ScormModel.php
blob: e7c5a1621f0c7869b6d8af89163b26fb7fcfb5ea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<?php


namespace Peopleaps\Scorm\Model;


use Illuminate\Database\Eloquent\Model;

/**
 * @property int $id
 * @property string $uuid
 * @property string $title
 * @property string $version
 * @property string $entryUrl
 */
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()
    {
        return $this->morphTo(__FUNCTION__, 'resource_type', 'resource_id');
    }

    public function getTable()
    {
        return config('scorm.table_names.scorm_table', parent::getTable());
    }

    public function scos()
    {
        return $this->hasMany(ScormScoModel::class, 'scorm_id', 'id');
    }
}