mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-03-14 17:10:19 -05:00
66 lines
2.1 KiB
PHP
Executable File
66 lines
2.1 KiB
PHP
Executable File
<?php
|
|
/**
|
|
* NOTICE OF LICENSE.
|
|
*
|
|
* UNIT3D Community Edition is open-sourced software licensed under the GNU Affero General Public License v3.0
|
|
* The details is bundled with this project in the file LICENSE.txt.
|
|
*
|
|
* @project UNIT3D Community Edition
|
|
* @author HDVinnie <hdinnovations@protonmail.com>
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
|
*/
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Helpers\Bbcode;
|
|
use App\Traits\Auditable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* @property int $id
|
|
* @property string|null $name
|
|
* @property string|null $slug
|
|
* @property string|null $content
|
|
* @property \Illuminate\Support\Carbon|null $created_at
|
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
|
*
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page newModelQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page newQuery()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page query()
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page whereContent($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page whereCreatedAt($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page whereId($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page whereName($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page whereSlug($value)
|
|
* @method static \Illuminate\Database\Eloquent\Builder|\App\Models\Page whereUpdatedAt($value)
|
|
* @mixin \Eloquent
|
|
*/
|
|
class Page extends Model
|
|
{
|
|
use Auditable;
|
|
|
|
/**
|
|
* Set The Pages Content After Its Been Purified.
|
|
*
|
|
* @param string $value
|
|
*
|
|
* @return void
|
|
*/
|
|
public function setContentAttribute($value)
|
|
{
|
|
$this->attributes['content'] = htmlspecialchars($value);
|
|
}
|
|
|
|
/**
|
|
* Parse Content And Return Valid HTML.
|
|
*
|
|
* @return string Parsed BBCODE To HTML
|
|
*/
|
|
public function getContentHtml()
|
|
{
|
|
$bbcode = new Bbcode();
|
|
|
|
return $bbcode->parse($this->content, true);
|
|
}
|
|
}
|