diff --git a/app/Models/Actor.php b/app/Models/Actor.php index 0d77077..fd09cf6 100644 --- a/app/Models/Actor.php +++ b/app/Models/Actor.php @@ -4,6 +4,7 @@ namespace App\Models; use App\Models\User; use App\Models\Activity; +use App\Models\Note; use App\Types\TypeActor; @@ -52,6 +53,11 @@ class Actor extends Model return $this->belongsTo (User::class); } + public function posts () + { + return $this->hasMany (Note::class, "actor_id")->orderBy ("created_at", "desc"); + } + public function create_from_user (User $user) { $data = TypeActor::create_from_user ($user); diff --git a/resources/views/components/comment_block.blade.php b/resources/views/components/comment_block.blade.php new file mode 100644 index 0000000..f572de1 --- /dev/null +++ b/resources/views/components/comment_block.blade.php @@ -0,0 +1,33 @@ +
+ {{ $actor->name }} +
+ + +
+ @if ($actor->user)
+
+ @else
+
+ @endif
+
+ + + +
++ {!! $post->content !!} +
+
+ @foreach ($post->attachments as $attachment)
+
+ @endforeach
+
{{ $actor->preferredUsername }}'s Friends Comments
-- - Displaying 0 of 0 comments (View all | Add Comment) - -
- -{{ $actor->preferredUsername }}'s Posts
+ {{ $actor->preferredUsername }} has {{ count ($actor->posts) }} posts. +
+ +