getting the posts of the user we follow
This commit is contained in:
parent
b5d43683f8
commit
26b67c8e3e
@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use App\Models\Post;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class HomeController extends Controller
|
||||
@ -9,8 +10,11 @@ class HomeController extends Controller
|
||||
public function __invoke()
|
||||
{
|
||||
// obtain following users
|
||||
dd(auth()->user()->following->pluck("id")->toArray());
|
||||
$ids = auth()->user()->following->pluck("id")->toArray();
|
||||
$posts = Post::whereIn("user_id", $ids)->latest()->paginate(24);
|
||||
|
||||
return view("home");
|
||||
return view("home", [
|
||||
"posts" => $posts
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user