Display Specific Post for User | Laravel Blog Project Tutorial for Beginners to Advance

Поділитися
Вставка
  • Опубліковано 9 лис 2024

КОМЕНТАРІ • 4

  • @gabriellRex
    @gabriellRex Рік тому +1

    Keep going man, i hope u also upload content

  • @rja1011
    @rja1011 6 місяців тому

    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');
    }

  • @spdrunner598
    @spdrunner598 Рік тому +1

    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

  • @ukplatform-iq6wq
    @ukplatform-iq6wq Місяць тому

    does this means you can post separate data for different users
    Help out am looking for that