@extends('front_end.pages.settings.layout') @section('title', 'Notification Settings - Socialink') @push('styles') @endpush @section('settings_content')
Notification Settings
@if(session('success'))
{{ session('success') }}
@endif @if(session('error'))
{{ session('error') }}
@endif @php $defaultNotificationSettings = [ 'notify_like' => 1, 'notify_comment' => 1, 'notify_share_post' => 1, 'notify_accept_request' => 1, 'notify_liked_page' => 1, 'notify_joined_group' => 1, 'notify_view_story' => 1, 'notify_visited_my_profile' => 0, 'notify_mentioned_me' => 1, 'notify_message' => 1, 'notify_friends_newpost' => 1, 'notify_profile_visit' => 1, 'notify_send_request' => 1, ]; $rawNotificationSettings = auth()->user()->notification_setting ?? []; if (is_string($rawNotificationSettings)) { $cleanJson = preg_replace('/[^\x20-\x7E]/', '', $rawNotificationSettings); $parsedNotificationSettings = json_decode($cleanJson, true) ?: []; } elseif (is_array($rawNotificationSettings)) { $parsedNotificationSettings = $rawNotificationSettings; } elseif ($rawNotificationSettings instanceof \Illuminate\Support\Collection) { $parsedNotificationSettings = $rawNotificationSettings->toArray(); } else { $parsedNotificationSettings = []; } $notificationSettings = array_merge($defaultNotificationSettings, $parsedNotificationSettings); $notificationSections = [ 'Post Activity' => [ 'icon' => '', 'options' => [ 'notify_like' => [ 'label' => 'Post Likes', 'description' => 'Receive alerts when someone likes your posts.', ], 'notify_comment' => [ 'label' => 'Post Comments', 'description' => 'Be notified when someone comments on your posts.', ], 'notify_share_post' => [ 'label' => 'Post Shares', 'description' => 'Know when someone shares your posts.', ], 'notify_friends_newpost' => [ 'label' => "Friends' New Posts", 'description' => 'Get notified when friends publish something new.', ], ], ], 'Connections & Messages' => [ 'icon' => '', 'options' => [ 'notify_send_request' => [ 'label' => 'Friend Requests Sent', 'description' => 'Updates when your friend requests are sent.', ], 'notify_accept_request' => [ 'label' => 'Friend Requests Accepted', 'description' => 'Alerts when someone accepts your friend request.', ], 'notify_message' => [ 'label' => 'Direct Messages', 'description' => 'Receive notifications for new direct messages.', ], ], ], 'Community Activity' => [ 'icon' => '', 'options' => [ 'notify_liked_page' => [ 'label' => 'Page Activity', 'description' => 'Stay updated when pages you like have new activity.', ], 'notify_joined_group' => [ 'label' => 'Group Membership', 'description' => 'Get alerts when someone joins your groups.', ], 'notify_view_story' => [ 'label' => 'Story Views', 'description' => 'See who viewed your stories.', ], ], ], 'Profile & Mentions' => [ 'icon' => '', 'options' => [ 'notify_mentioned_me' => [ 'label' => 'Mentions', 'description' => 'Be notified when someone mentions you.', ], 'notify_profile_visit' => [ 'label' => 'Profile Visits', 'description' => 'Alerts when other members view your profile.', ], 'notify_visited_my_profile' => [ 'label' => 'Share My Visits', 'description' => 'Notify others when you visit their profile.', ], ], ], ]; @endphp

Choose when and how you want to receive notifications about activity on Socialink. You can update these settings anytime.

@csrf @foreach($notificationSections as $sectionTitle => $sectionData)
{!! $sectionData['icon'] !!} {{ $sectionTitle }}
@foreach($sectionData['options'] as $field => $meta)
{{ $meta['label'] }}
@if(!empty($meta['description']))
{{ $meta['description'] }}
@endif
@endforeach
@endforeach
@endsection