Should Return to the Page Even Without Login in Laravel 5.4

Should Return to the Page Even Without Login in Laravel 5.4

I am working on laravel 5.4 project. I want to access some pages even without logged in but it always redirect to the login page. Here's my code. Is there anything i can do in middleware? Can you guys help me with this? i'm not really good in laravel. Thank you in advance guys.

I am working on laravel 5.4 project. I want to access some pages even without logged in but it always redirect to the login page. Here's my code. Is there anything i can do in middleware? Can you guys help me with this? i'm not really good in laravel. Thank you in advance guys.

Route

<?php

Route::get('/', function () { return view('pages.index'); });

Auth::routes();

Route::get('/home', '[email protected]')->name('home'); Route::get('/admin_dashboard', '[email protected]_dashboard'); Route::get('/admin_course_category', '[email protected]_course_category');

Route::get('/modal_add_course_category', '[email protected]_add_course_category'); Route::post('/save_category', '[email protected]_category');

//header routes Route::get('/ak_news', '[email protected]_news');

Controller

public function ak_news()
{
    $newscategory = DB::table('tak_news_category')->get();

$news = DB::table('tak_news')
    -&gt;select('tak_news.*', 'tak_news.id as newsid', 'tak_news_category.id', 'tak_news_category.tak_news_category')
    -&gt;join('tak_news_category', 'tak_news_category.id', '=', 'tak_news.tak_category_id')
    -&gt;whereRaw('MOD(tak_news.id, 2) = 0')
    -&gt;get();

$news1 = DB::table('tak_news')
    -&gt;select('tak_news.*', 'tak_news.id as newsid', 'tak_news_category.id', 'tak_news_category.tak_news_category')
    -&gt;join('tak_news_category', 'tak_news_category.id', '=', 'tak_news.tak_category_id')
    -&gt;inRandomOrder()-&gt;limit(1)
    -&gt;whereRaw('MOD(tak_news.id, 1) = 0')
    -&gt;get();
$news2 = DB::table('tak_news')
    -&gt;select('tak_news.*', 'tak_news.id as newsid', 'tak_news_category.id', 'tak_news_category.tak_news_category')
    -&gt;join('tak_news_category', 'tak_news_category.id', '=', 'tak_news.tak_category_id')
    -&gt;inRandomOrder()-&gt;limit(1)
    -&gt;get();

$latestnews = DB::table('tak_news')
    -&gt;select('tak_news.*', 'tak_news.id as newsid', 'tak_news_category.id', 'tak_news_category.tak_news_category')
    -&gt;join('tak_news_category', 'tak_news_category.id', '=', 'tak_news.tak_category_id')
    -&gt;orderBY('tak_news.id', 'DESC')
    -&gt;limit(4)
    -&gt;get();

$editors = DB::table('tak_news')
    -&gt;select('tak_news.*', 'tak_news.id as newsid', 'tak_news_category.id', 'tak_news_category.tak_news_category')
    -&gt;join('tak_news_category', 'tak_news_category.id', '=', 'tak_news.tak_category_id')
    -&gt;where('tak_news.id', '=', '6')
    -&gt;get();

return view('pages.news_page', compact('newscategory', 'news', 'news1', 'news2', 'latestnews', 'editors'));

}

View layout

<!DOCTYPE html>
<html lang="{{ app()->getLocale() }}">
<head>
    <!-- Mobile Specific Meta -->
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Favicon-->
    <link rel="shortcut icon" href="img/fav.png">
    <!-- Author Meta -->
    <meta name="author" content="colorlib">
    <!-- Meta Description -->
    <meta name="description" content="">
    <!-- Meta Keyword -->
    <meta name="keywords" content="">
    <!-- meta character set -->
    <meta charset="UTF-8">
    <!-- Site Title -->
    <title>yeah</title>
    <link href="https://fonts.googleapis.com/css?family=Poppins:100,200,400,300,500,600,700" rel="stylesheet">
    <!--
    CSS
    ============================================= -->
    <link rel="stylesheet" href="css/linearicons.css">
    <link rel="stylesheet" href="css/font-awesome.min.css">
    <link rel="stylesheet" href="css/bootstrap.css">
    <link rel="stylesheet" href="css/magnific-popup.css">
    <link rel="stylesheet" href="css/nice-select.css">
    <link rel="stylesheet" href="css/animate.min.css">
    <link rel="stylesheet" href="css/owl.carousel.css">
    <link rel="stylesheet" href="css/jquery-ui.css">
    <link rel="stylesheet" href="css/main.css">
</head>
<body>
    <header>

    &lt;div class="container main-menu" id="main-menu"&gt;
        &lt;div class="row align-items-center justify-content-between"&gt;
            &lt;nav id="nav-menu-container"&gt;
                &lt;ul class="nav-menu"&gt;
                    &lt;li class="menu-active"&gt;&lt;a href="index.html"&gt;Home&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href="archive.html"&gt;Archive&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href="category.html"&gt;Category&lt;/a&gt;&lt;/li&gt;
                    &lt;li class="menu-has-children"&gt;&lt;a href=""&gt;Post Types&lt;/a&gt;
                    &lt;ul&gt;
                        &lt;li&gt;&lt;a href="standard-post.html"&gt;Standard Post&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="image-post.html"&gt;Image Post&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="gallery-post.html"&gt;Gallery Post&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="video-post.html"&gt;Video Post&lt;/a&gt;&lt;/li&gt;
                        &lt;li&gt;&lt;a href="audio-post.html"&gt;Audio Post&lt;/a&gt;&lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/li&gt;
                &lt;li&gt;&lt;a href="about.html"&gt;About&lt;/a&gt;&lt;/li&gt;
                &lt;li&gt;&lt;a href="contact.html"&gt;Contact&lt;/a&gt;&lt;/li&gt;
            &lt;/ul&gt;
            &lt;/nav&gt;&lt;!-- #nav-menu-container --&gt;
            &lt;div class="navbar-right"&gt;
                &lt;form class="Search"&gt;
                    &lt;input type="text" class="form-control Search-box" name="Search-box" id="Search-box" placeholder="Search"&gt;
                    &lt;label for="Search-box" class="Search-box-label"&gt;
                        &lt;span class="lnr lnr-magnifier"&gt;&lt;/span&gt;
                    &lt;/label&gt;
                    &lt;span class="Search-close"&gt;
                        &lt;span class="lnr lnr-cross"&gt;&lt;/span&gt;
                    &lt;/span&gt;
                &lt;/form&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/header&gt;

@yield('content')

&lt;!-- start footer Area --&gt;
&lt;footer class="footer-area section-gap"&gt;
    &lt;div class="container"&gt;
        &lt;div class="row"&gt;
            &lt;div class="col-lg-3 col-md-6 single-footer-widget"&gt;
                &lt;h4&gt;Top Products&lt;/h4&gt;
                &lt;ul&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Managed Website&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Manage Reputation&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Power Tools&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Marketing Service&lt;/a&gt;&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/div&gt;
            &lt;div class="col-lg-2 col-md-6 single-footer-widget"&gt;
                &lt;h4&gt;Quick Links&lt;/h4&gt;
                &lt;ul&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Jobs&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Brand Assets&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Investor Relations&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Terms of Service&lt;/a&gt;&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/div&gt;
            &lt;div class="col-lg-2 col-md-6 single-footer-widget"&gt;
                &lt;h4&gt;Features&lt;/h4&gt;
                &lt;ul&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Jobs&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Brand Assets&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Investor Relations&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Terms of Service&lt;/a&gt;&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/div&gt;
            &lt;div class="col-lg-2 col-md-6 single-footer-widget"&gt;
                &lt;h4&gt;Resources&lt;/h4&gt;
                &lt;ul&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Guides&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Research&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Experts&lt;/a&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;a href="#"&gt;Agencies&lt;/a&gt;&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/div&gt;
            &lt;div class="col-lg-3 col-md-6 single-footer-widget"&gt;
                &lt;h4&gt;Instragram Feed&lt;/h4&gt;
                &lt;ul class="instafeed d-flex flex-wrap"&gt;
                    &lt;li&gt;&lt;img src="img/i1.jpg" alt=""&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;img src="img/i2.jpg" alt=""&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;img src="img/i3.jpg" alt=""&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;img src="img/i4.jpg" alt=""&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;img src="img/i5.jpg" alt=""&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;img src="img/i6.jpg" alt=""&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;img src="img/i7.jpg" alt=""&gt;&lt;/li&gt;
                    &lt;li&gt;&lt;img src="img/i8.jpg" alt=""&gt;&lt;/li&gt;
                &lt;/ul&gt;
            &lt;/div&gt;
        &lt;/div&gt;
        &lt;div class="footer-bottom row align-items-center"&gt;

            &lt;div class="col-lg-4 col-md-12 footer-social"&gt;
                &lt;a href="#"&gt;&lt;i class="fa fa-facebook"&gt;&lt;/i&gt;&lt;/a&gt;
                &lt;a href="#"&gt;&lt;i class="fa fa-twitter"&gt;&lt;/i&gt;&lt;/a&gt;
                &lt;a href="#"&gt;&lt;i class="fa fa-dribbble"&gt;&lt;/i&gt;&lt;/a&gt;
                &lt;a href="#"&gt;&lt;i class="fa fa-behance"&gt;&lt;/i&gt;&lt;/a&gt;
            &lt;/div&gt;
        &lt;/div&gt;
    &lt;/div&gt;
&lt;/footer&gt;
&lt;!-- End footer Area --&gt;
&lt;script src="js/vendor/jquery-2.2.4.min.js"&gt;&lt;/script&gt;
&lt;script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"&gt;&lt;/script&gt;
&lt;script src="js/vendor/bootstrap.min.js"&gt;&lt;/script&gt;
&lt;script src="https://maps.googleapis.com/maps/api/js?key=AIzaSyBhOdIF3Y9382fqJYt5I_sswSrEw5eihAA"&gt;&lt;/script&gt;
&lt;script src="js/easing.min.js"&gt;&lt;/script&gt;
&lt;script src="js/hoverIntent.js"&gt;&lt;/script&gt;
&lt;script src="js/superfish.min.js"&gt;&lt;/script&gt;
&lt;script src="js/jquery.ajaxchimp.min.js"&gt;&lt;/script&gt;
&lt;script src="js/jquery.magnific-popup.min.js"&gt;&lt;/script&gt;
&lt;script src="js/mn-accordion.js"&gt;&lt;/script&gt;
&lt;script src="js/jquery-ui.js"&gt;&lt;/script&gt;
&lt;script src="js/jquery.nice-select.min.js"&gt;&lt;/script&gt;
&lt;script src="js/owl.carousel.min.js"&gt;&lt;/script&gt;
&lt;script src="js/mail-script.js"&gt;&lt;/script&gt;
&lt;script src="js/main.js"&gt;&lt;/script&gt;

</body>

Hope you can help me guys. Thank you.

php laravel database

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

How to Store Form Data in Database using PHP -2020

in PHP Insert Data Into MySQL Database From Form. Here you will learn how you can insert or store or save form data into mysql database table using PHP code

Php how to delete multiple rows through checkbox using ajax in laravel

In this article i will let you know to delete multiple rows through checkbox using ajax in laravel and before delete we will give a confirmation message.

Login Page in PHP with Database Source Code

Simple login form in PHP using session. Here you'll learn how to create complete login form and authenticate users from MySQL database in PHP.

PHP Code for Update Data in MySQL Database - Tuts Make

PHP code for updating data in mysql database. Here we'll show you how to fetch and update form data into mysql database using PHP code. &demo

"Specified key was too long; max key length is 767 bytes" Error in Laravel

One of these issues you might stumble across using the PHP framework Laravel is this one. After some research, I've found out it's coming up when using older versions of MySQL (prior to 5.7.8) or MariaDB (prior to 10.2.2). It was MariaDB in my case.