0
0

More than 3 years have passed since last update.

猫の写真と日記投稿サイト ページネーション

Last updated at Posted at 2021-02-14

diaries.controller index部分

public function index()
{

    $data = [];
    if (\Auth::check()) {
        $user = \Auth::user();
        $diaries = $user->diaries()->orderBy('created_at', 'desc')->paginate(25);
        return view('diaries.index', [
        'diaries' => $diaries,
    ]);


        $data = [
            'user' => $user,
            'diaries' => $diaries,
        ];
    }

    return view('welcome', $data);
}

index.blade.php部分

@endif

{{ $messages->links('pagination::bootstrap-4') }}

{!! link_to_route('messages.create', '新規投稿', [], ['class' => 'btn btn-primary']) !!}

@endsection

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0