Add NAS file manager integration and all pending platform changes
- 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 <[email protected]>
This commit is contained in:
1 parent
d44490dfe0
commit
0b2e95ea65
161 files changed
+27496
-7250
No files matched your search
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class Post extends Model
|
||||
{
|
||||
protected $fillable = ['user_id', 'body', 'video_id', 'image'];
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->belongsTo(User::class);
|
||||
}
|
||||
|
||||
public function video()
|
||||
{
|
||||
return $this->belongsTo(Video::class)->withDefault();
|
||||
}
|
||||
|
||||
public function reactions()
|
||||
{
|
||||
return $this->hasMany(PostReaction::class);
|
||||
}
|
||||
|
||||
public function postImages()
|
||||
{
|
||||
return $this->hasMany(PostImage::class)->orderBy('sort_order');
|
||||
}
|
||||
|
||||
public function postVideos()
|
||||
{
|
||||
return $this->hasMany(PostVideo::class)->with('video')->orderBy('sort_order');
|
||||
}
|
||||
|
||||
public function isLikedBy(?User $user): bool
|
||||
{
|
||||
if (! $user) return false;
|
||||
return $this->reactions()->where('user_id', $user->id)->exists();
|
||||
}
|
||||
|
||||
public function getReactionCountAttribute(): int
|
||||
{
|
||||
return $this->reactions()->count();
|
||||
}
|
||||
|
||||
public function getImageUrlAttribute(): ?string
|
||||
{
|
||||
return $this->image ? asset('storage/post_images/' . $this->image) : null;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user