@extends('layouts.app') @section('content')
@if (session('success'))
{{ session('success') }}
@endif @if (session('error'))
{{ session('error') }}
@endif

{{ $question->title }}

{{ $question->content }}

Asked by {{ $question->user->name }}, {{ $question->created_at->diffForHumans() }}

@auth
@csrf
@else @endauth {{ $question->upvotes }}
@auth @if(Auth::id() === $question->user_id || Auth::user()->is_admin)
@csrf @method('DELETE')
@endif @endauth

Answers

@foreach($question->answers as $answer)

{{ $answer->content }}

Answered by {{ $answer->user->name }}, {{ $answer->created_at->diffForHumans() }}

@auth
@csrf
@else @endauth {{ $answer->upvotes }}
@endforeach @auth @if(Auth::id() !== $question->user_id)
@csrf
@else

You cannot answer your own question. :))

@endif @else

Please login to post an answer.

@endauth
@endsection