We have created a view page name as login.blade.php
<div class="col-sm-4">
<h3>Login</h3>
<form action="userlogin" method="post">
@csrf
<input type="text" class="form-control" name="username"
placeholder="UserName">
<br>
<input type="password" class="form-control" name="password"
placeholder="Password">
<br>
<input type="submit" class="btn btn-primary" value="Login">
</form>
</div>
We will use the post method, and our action page is userlogin.
create a controller name as LoginController
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class LoginController extends Controller
{
function postdata(Request $dreq)
{
return $dreq->input();
}
}
Now create two routes 1st for the view page and 2nd is action page
Route::post("userlogin",[LoginController::class,"postdata"]);
Route::view("login","/login");
After submission, we get this data.
{"_token":"iZo8FOLpL2WTRtklISJrK2OInGAXLbkRE7ak2ytz","username":"ebluesys","passwor
d":"123456"}
Remember that you should always use @csrt token in every HTML form. Laravel includes a CSRF token as a hidden field in the form. This token is unique to the user's session and changes with each request. These are core security features in the Laravel framework.
Create New middleware for the route. php artisan make:middleware MyrouteMiddleware ..
Create a New Middleware php artisan make:middleware NameOfMiddleware This is..
Middleware can verify the user's authentication status and ensure they have the necessary credential..
We have created a view page name as login.blade.php <div class="col-sm-4"><h3>L..
Suppose you have data and you need to check it by clicking or page onload. first, create a controll..
Blade is a templating engine used in Laravel, a popular PHP framework. It provides a simple and expr..
Current Url <div class="container-fluid p-5 bg-primary text-white text-center"><h1..
A component is a group of code like a header or footer. Which are re-useable. Common part ofapplicat..
In Laravel, a controller is a class that handles the logic and acts as an intermediary between themo..
It's Easy to create routes. Already we know That all route files should be kept in the routes ..
The blade is the templating engine used in Laravel, which is a popular PHP framework. It provides at..
Laravel is a popular open-source PHP framework known for its elegant syntax, expressive features, an..
In Laravel, you can set dynamic page titles by utilizing the power of Blade templating and passing d..
To set up a Laravel project with Bootstrap, you can follow these steps: Create a project, I..
How to Install Laravel using Composer First, we need to install Composer. check How to inst..
How to Install Composer on Linux Open terminal php -r "copy('https://getcomposer.o..
Get the latest news and updates by signing up to our daily newsletter.We won't sell your email or spam you !