I am new to Laravel. I am now able to register users, log them in. But after login, I don't want to display register and login pages. I want to display logout link. This is easy for me with core php. I want something similar like the one below.

<?php
  if(isset($_SESSION['id'])){
      ?>
      <a href="index.php">Home</a>
      <a href="dashboard.php">Dashboard</a>
      <a href="logout.php">Logout</a>
      <?php
  }else{
      ?>
      <a href="index.php">Home</a>
      <a href="register.php">Register</a>
      <a href="login">Login</a>   
      <?php
  }
  ?>

Thanks for helping

You can do this in Laravel using the auth() helper:

@if (auth()->check())
    <a href="dashboard.php">Dashboard</a>
    <a href="logout.php">Logout</a>
@else
    <a href="register.php">Register</a>
    <a href="login">Login</a>   
@endif

Hey, you can refer to this Source. You can find more about laravel here. Can be helpful!

You can do this in Laravel using the auth() helper:

@if (auth()->check())
    <a href="dashboard.php">Dashboard</a>
    <a href="logout.php">Logout</a>
@else
    <a href="register.php">Register</a>
    <a href="login">Login</a>   
@endif

Hey, you can refer to this Source. You can find more about laravel here. Can be helpful!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.