37 lines
784 B
PHP
37 lines
784 B
PHP
<?php
|
|
|
|
namespace BitGoblin\Goliath\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use League\CommonMark\CommonMarkConverter;
|
|
|
|
class Queue extends Model {
|
|
|
|
protected $fillable = [
|
|
'title',
|
|
'description',
|
|
];
|
|
|
|
public function tickets() {
|
|
return $this->hasMany(Ticket::class);
|
|
}
|
|
|
|
public function render(): string {
|
|
$converter = new CommonMarkConverter([
|
|
'html_input' => 'strip',
|
|
'allow_unsafe_links' => false,
|
|
]);
|
|
|
|
return $converter->convert($this->description);
|
|
}
|
|
|
|
public function formatCreatedAt(): string {
|
|
return date_format(date_create($this->created_at), "F jS\\, Y \\a\\t g:i:s a");
|
|
}
|
|
|
|
public function formatUpdatedAt(): string {
|
|
return date_format(date_create($this->updated_at), "F jS\\, Y \\a\\t g:i:s a");
|
|
}
|
|
|
|
}
|