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); return $this->create ($data); } public static function build_response (Actor $actor) { return TypeActor::build_response ($actor); } public function friends_with (Actor $actor) { $following = Activity::where ("actor", $this->actor_id)->where ("type", "Follow")->where ("object", $actor->actor_id)->first (); $followers = Activity::where ("actor", $actor->actor_id)->where ("type", "Follow")->where ("object", $this->actor_id)->first (); return $following && $followers; } }