@extends('layouts.landing') @section('title') Notifications @endsection @section('content')
Back to feeds

Notifications

@forelse ($notifications as $notification)
@php $user = App\Models\User::where('id', $notification->from_id)->first(); @endphp
{{$user->first_name}} {{$user->last_name}}

@if($notification->type == 'like_post') @php $feed = App\Models\Feed::where('id', $notification->reference_id)->first(); @endphp {{$notification->description}} @elseif($notification->type == 'like_comment') @php $comment = App\Models\Comment::where('id', $notification->reference_id)->first(); $feed = App\Models\Feed::where('id', $comment->feed_id)->first(); @endphp {{$notification->description}} @elseif($notification->type == 'like_comment_reply') @php $comment_reply = App\Models\CommentReply::where('id', $notification->reference_id)->first(); $feed = App\Models\Feed::where('id', $comment_reply->feed_id)->first(); @endphp {{$notification->description}} @elseif($notification->type == 'comment') @php $comment = App\Models\Comment::where('id', $notification->reference_id)->first(); $feed = App\Models\Feed::where('id', $comment->feed_id)->first(); @endphp {{$notification->description}} @elseif($notification->type == 'comment_reply') @php $comment_reply = App\Models\CommentReply::where('id', $notification->reference_id)->first(); $feed = App\Models\Feed::where('id', $comment_reply->feed_id)->first(); @endphp {{$notification->description}} @elseif($notification->type == 'followed') {{$notification->description}} @endif

{{$notification->created_at->diffForHumans()}}

@if($notification->type == 'comment') @php $comment = App\Models\Comment::where('id', $notification->reference_id)->first(); $feed = App\Models\Feed::where('id', $comment->feed_id)->first(); @endphp "{{Str::words($comment->comment_body, 10)}}" @elseif($notification->type == 'comment_reply') @php $comment_reply = App\Models\CommentReply::where('id', $notification->reference_id)->first(); $feed = App\Models\Feed::where('id', $comment_reply->feed_id)->first(); @endphp "{{Str::words($comment_reply->comment_reply_body, 10)}}" @elseif($notification->type == 'like_comment') @php $comment = App\Models\Comment::where('id', $notification->reference_id)->first(); $feed = App\Models\Feed::where('id', $comment->feed_id)->first(); @endphp "{{Str::words($comment->comment_body, 10)}}" @elseif($notification->type == 'like_comment_reply') @php $comment_reply = App\Models\CommentReply::where('id', $notification->reference_id)->first(); $feed = App\Models\Feed::where('id', $comment_reply->feed_id)->first(); @endphp "{{Str::words($comment_reply->comment_reply_body, 10)}}" @endif

@empty

No notifications

@endforelse
@endsection