33 خطوط
841 B
PHP
33 خطوط
841 B
PHP
<?php
|
|
|
|
namespace App\Modules\LearningPaths\Domain;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Concerns\HasUlids;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
|
|
|
class LearningPath extends Model
|
|
{
|
|
use HasUlids;
|
|
|
|
protected $fillable = ['organization_id', 'title', 'slug', 'status', 'created_by'];
|
|
|
|
public function versions(): HasMany
|
|
{
|
|
return $this->hasMany(LearningPathVersion::class);
|
|
}
|
|
|
|
public function latestVersion(): HasOne
|
|
{
|
|
return $this->hasOne(LearningPathVersion::class)->ofMany('version_number', 'max');
|
|
}
|
|
|
|
public function creator(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'created_by');
|
|
}
|
|
}
|