- Installed p7h/nas-file-manager package via private VCS repo - Published config/nas-file-manager.php with super_admin middleware restriction - Added NAS env vars to .env.example - Created admin/nas-storage page with connection info panel and file browser widget - Added NAS Storage link to admin sidebar (super_admin only) - Added SuperAdminController@nasStorage method and admin.nas-storage route - Includes all accumulated branch changes: profile wall, 2FA, audit logs, settings panel, country/phone/timezone components, posts, slideshow, playlist shares, video downloads/shares, comment likes, notifications, social links, and more Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
60 lines
1.2 KiB
PHP
60 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Comment extends Model
|
|
{
|
|
protected $fillable = [
|
|
'video_id',
|
|
'user_id',
|
|
'parent_id',
|
|
'body',
|
|
];
|
|
|
|
// Relationships
|
|
public function video()
|
|
{
|
|
return $this->belongsTo(Video::class);
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
public function parent()
|
|
{
|
|
return $this->belongsTo(Comment::class, 'parent_id');
|
|
}
|
|
|
|
public function replies()
|
|
{
|
|
return $this->hasMany(Comment::class, 'parent_id')->latest();
|
|
}
|
|
|
|
public function likes()
|
|
{
|
|
return $this->hasMany(CommentLike::class);
|
|
}
|
|
|
|
// Get mentioned users from comment body
|
|
public function getMentionedUsers()
|
|
{
|
|
preg_match_all('/@(\w+)/', $this->body, $matches);
|
|
if (empty($matches[1])) {
|
|
return collect();
|
|
}
|
|
return User::whereIn('username', $matches[1])->get();
|
|
}
|
|
|
|
// Parse mentions and make them clickable
|
|
public function getParsedBodyAttribute()
|
|
{
|
|
$body = e($this->body);
|
|
$body = preg_replace('/@(\w+)/', '<a href="/channel/$1" class="user-mention">@$1</a>', $body);
|
|
return $body;
|
|
}
|
|
}
|