Instead of creating a separate post page we can use the homepage itself with just the user posts only displayed.... public function my_post() { if (Auth::check()) { $usertype = Auth::user()->usertype; if ($usertype == 'user') { $post = Post::where('user_id', '1')->get(); return view('home.homepage', compact('post')); } } return redirect()->route('login'); }
Keep going man, i hope u also upload content
Instead of creating a separate post page we can use the homepage itself with just the user posts only displayed....
public function my_post()
{
if (Auth::check()) {
$usertype = Auth::user()->usertype;
if ($usertype == 'user') {
$post = Post::where('user_id', '1')->get();
return view('home.homepage', compact('post'));
}
}
return redirect()->route('login');
}
or if you want to add like a alternating color u may use this for each
@foreach ($data as $key => $item)
@if(($key+1) % 2 == 0)
{{ $item->title }}
{{ $item->description }}
@else
{{ $item->title }}
{{ $item->description }}
@endif
@endforeach
does this means you can post separate data for different users
Help out am looking for that