mirror of
https://github.com/HDInnovations/UNIT3D-Community-Edition.git
synced 2026-02-07 03:58:52 -06:00
57 lines
1.2 KiB
PHP
57 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* NOTICE OF LICENSE
|
|
*
|
|
* UNIT3D is open-sourced software licensed under the GNU General Public License v3.0
|
|
* The details is bundled with this project in the file LICENSE.txt.
|
|
*
|
|
* @project UNIT3D
|
|
* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0
|
|
* @author HDVinnie
|
|
*/
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use App\Helpers\Bbcode;
|
|
|
|
class PrivateMessage extends Model
|
|
{
|
|
protected $fillable = [
|
|
'sender_id', 'reciever_id', 'subject', 'message', 'read', 'related_to'
|
|
];
|
|
|
|
/**
|
|
* PM belongs to User
|
|
*
|
|
*/
|
|
public function sender()
|
|
{
|
|
return $this->belongsTo(\App\User::class, "sender_id")->withDefault([
|
|
'username' => 'System',
|
|
'id' => '1'
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* PM belongs to User
|
|
*
|
|
*/
|
|
public function receiver()
|
|
{
|
|
return $this->belongsTo(\App\User::class, "reciever_id")->withDefault([
|
|
'username' => 'System',
|
|
'id' => '1'
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Parse message and return valid HTML
|
|
*
|
|
*/
|
|
public function getMessageHtml()
|
|
{
|
|
return Bbcode::parse($this->message);
|
|
}
|
|
}
|