mirror of
https://github.com/dyzulk/trustlab-api.git
synced 2026-01-26 13:22:05 +07:00
First commit
This commit is contained in:
32
app/Models/LegalPage.php
Normal file
32
app/Models/LegalPage.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Concerns\HasUuids;
|
||||
|
||||
class LegalPage extends Model
|
||||
{
|
||||
use HasFactory, HasUuids;
|
||||
|
||||
protected $fillable = ['title', 'slug', 'is_active'];
|
||||
|
||||
public $incrementing = false;
|
||||
protected $keyType = 'string';
|
||||
|
||||
public function revisions()
|
||||
{
|
||||
return $this->hasMany(LegalPageRevision::class);
|
||||
}
|
||||
|
||||
public function latestRevision()
|
||||
{
|
||||
return $this->hasOne(LegalPageRevision::class)->latestOfMany('created_at');
|
||||
}
|
||||
|
||||
public function currentRevision()
|
||||
{
|
||||
return $this->hasOne(LegalPageRevision::class)->where('is_active', true)->latest();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user