• 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

(Cache::lock()) -> get() -- Under what conditions does it return false?

Unable to create lockable file - Laravel 8 & PHP 8

Cannot connect to own websocket server when on secured domain

Maatwebsite Excel 3.1 : how do I skip duplicate data when imported?

Toggle between a textbox and a select using PHP

Laravel MSSQL Server Connection not working

OAuth2 Token PHP

Sum array values of a column within each column of an array with 3 levels

PHP Print to Network Printer

Laravel query builder binding parameters more than once

How to get transaction details in notify_url page in paypal

How to override header set in Apache config with more specific header in a virtual host

renameColumn migration fails for existing column with columns does not exist error

Mysqli Output to a table

Method IlluminateAuthRequestGuard::logout does not exist Laravel Passport

About Contact Privacy policy Terms and conditions