• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

How to create custom authentication in laravel 8?

phplaravel


PHP Snippet 1:

protected function validateLogin(Request $request)
{
    $request->validate([
        $this->username() => 'required|string',
        'password' => 'required|string',
    ]);
}

protected function credentials(Request $request)
{
    return $request->only($this->username(), 'password');
}

//Mention your username here
public function username()
{
    return 'user_name';
}

Related Snippets

Laravel s3 upload file with metadata using pre-signed url

Doctrine 2 mapping referencing unique key

Sliders in Laravel

Laravel-fopen: failed to open stream: Permission denied

Why "Class 'GuzzleHttpClient' not found" even after Installing it in Laravel?

Ajax GET request fails in laravel 8

Symfony run hint kernel.secret parameter not found

Facebook SDK error: Cross-site request forgery validation failed. Required param "state" missing from persistent data

Refresh specific HTML content that retrieves data from MySQL

What is PHP's equivalent of JavaScript's "array.every()"?

Laravel passport auth token not working after moving to different server

Laravel PackageManifest.php: Undefined index: name

OctoberCMS / Anonymous Global Scope

WooCommerce Additional Information - if empty, hide

How to get variable from JavaScript to PHP [duplicate]

About Contact Privacy policy Terms and conditions