From e617fbe552030d199433ce5d5d31b2799c59eda5 Mon Sep 17 00:00:00 2001 From: SynergixeNG <10416482+synergixe@users.noreply.github.com> Date: Thu, 11 Oct 2018 20:33:13 +0100 Subject: [PATCH] Update README.md --- README.md | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index aff6f56..c4d0a72 100644 --- a/README.md +++ b/README.md @@ -275,9 +275,8 @@ php artisan migrate $user = \Auth::user(); $followee = User::where('id', '=', $request->input('followee_id')); - $follow = $user->followings()->save([ - 'follower_id' => $user->id, - 'followee_id' => $followee->id + $follow = $user->follows()->attach([ + $followee->id ]); $event = new NotificableEvent( @@ -320,14 +319,23 @@ php artisan migrate return $this->email_address; } - public function followings(){ // relation for all `followings` + public function follows(){ // relation for all `follows` return $this->belongsToMany(User::class, 'social_network_follows', - 'followee_id', 'follower_id', 'id', 'id', 'followings' + 'followee_id', 'follower_id', 'id', 'id', 'follows' )->withTimestamps(); } + public function followers(){ // relation for all `followers` + + return $this->belongsToMany(User::class, + 'social_network_follows', + 'follower_id', 'followee_id', 'id', 'id', 'followers' + )->withTimestamps(); + + } + /* create the `makeDescription` method for trait { Describable } */ public function makeDecription(){ @@ -388,7 +396,7 @@ php artisan migrate new ActivityStreamNotification( $event->producer, $event->reciever, - $event->timstamp, + $event->timestamp, $event_kind ) )->delay(