Migration complete
This commit is contained in:
@@ -4,10 +4,12 @@ namespace App\Models;
|
||||
|
||||
use App\Helpers\EntryHelpers;
|
||||
use App\Traits\HasGallery;
|
||||
use App\Traits\HasXenforoUserId;
|
||||
use Illuminate\Database\Eloquent\Builder;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
use League\CommonMark\GithubFlavoredMarkdownConverter;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
@@ -59,7 +61,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
||||
class News extends Model
|
||||
{
|
||||
|
||||
use SoftDeletes, HasGallery;
|
||||
use SoftDeletes, HasGallery, HasXenforoUserId;
|
||||
|
||||
protected $table = 'news';
|
||||
|
||||
@@ -108,6 +110,16 @@ class News extends Model
|
||||
return $this->belongsTo(Category::class);
|
||||
}
|
||||
|
||||
public function getDescriptionHtmlAttribute(): string
|
||||
{
|
||||
$converter = new GithubFlavoredMarkdownConverter([
|
||||
'html_input' => 'strip',
|
||||
'allow_unsafe_links' => false,
|
||||
]);
|
||||
|
||||
return $converter->convert($this->description)->getContent();
|
||||
}
|
||||
|
||||
public function getYoutubeVideoId(): ?string {
|
||||
if( !$this->youtube_link )
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user