如何将getstream集成到laravel中(How to integrate getstream in laravel)

编程入门 行业动态 更新时间:2024-10-28 12:26:38
如何将getstream集成到laravel中(How to integrate getstream in laravel)

请我尝试在laravel中设置getstream。 他们的教程对我个人来说并不是非常有帮助,我认为它已经很老了。 我如何设置模型,现在我只想让用户看到他和他的朋友发布的帖子,就这么简单。 请帮帮我。 谢谢

<?php namespace App\Http\Controllers; use App\Follow; use Auth; use App; use Illuminate\Http\Request; class FollowController extends Controller { /** * Let current user follow user $target_id * * @return Response */ public function store(Request $request) { $target_id = $request->target; $user_id = Auth::id(); $params = array( 'user_id' => Auth::id(), 'target_id' => $target_id, ); $follow = Follow::withTrashed($params)->where($params)->first(); if ($follow === null) { $follow = new Follow($params); $follow->save(); FeedManager::followUser($follow->user_id, $follow->target_id); } elseif ($follow->trashed()){ $follow->restore(); FeedManager::followUser($follow->user_id, $follow->target_id); } return Redirect::to(Input::get('next')); } public function destroy($resource) { $follow = Follow::firstOrNew(array( 'id' => $resource, 'user_id' => Auth::id() ) ); if ($follow->id !== null) { $manager = App::make('feed_manager'); FeedManager::unfollowUser($follow->user_id, $follow->target_id); $follow->delete(); } return Redirect::to(Input::get('next')); }

}

please i am trying to setup getstream in laravel. Their tutorial has not been very helpful to me personally, I think it is quite old. How do I setup the models, for now i just want the user to see posts that he and his friends make, as simple as that. Please help me. Thanks

<?php namespace App\Http\Controllers; use App\Follow; use Auth; use App; use Illuminate\Http\Request; class FollowController extends Controller { /** * Let current user follow user $target_id * * @return Response */ public function store(Request $request) { $target_id = $request->target; $user_id = Auth::id(); $params = array( 'user_id' => Auth::id(), 'target_id' => $target_id, ); $follow = Follow::withTrashed($params)->where($params)->first(); if ($follow === null) { $follow = new Follow($params); $follow->save(); FeedManager::followUser($follow->user_id, $follow->target_id); } elseif ($follow->trashed()){ $follow->restore(); FeedManager::followUser($follow->user_id, $follow->target_id); } return Redirect::to(Input::get('next')); } public function destroy($resource) { $follow = Follow::firstOrNew(array( 'id' => $resource, 'user_id' => Auth::id() ) ); if ($follow->id !== null) { $manager = App::make('feed_manager'); FeedManager::unfollowUser($follow->user_id, $follow->target_id); $follow->delete(); } return Redirect::to(Input::get('next')); }

}

最满意答案

您似乎缺少此处概述的一些设置步骤: https : //github.com/GetStream/Stream-Laravel (Stream-Laravel包)

特别是针对您的错误消息,您的应用似乎没有配置FeedManager外观。

It seems like you are missing some of the setup steps outlined here: https://github.com/GetStream/Stream-Laravel (the Stream-Laravel package)

Specifically to your error message, it seems like your app does not have the FeedManager facade configured.

更多推荐

本文发布于:2023-07-27 17:57:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1293644.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何将   getstream   integrate   laravel

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!