• 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

Failing validation doesn't stop code execution in livewire component

Laravel/docker-compose/redis - Class 'Redis' not found

PHP-Sort array based on another array?

Is it possible to re-use an array taken from PHP via JSON in a $.ajax function?

Eloquent insert id with sequence next value

PHP date() with timezone?

401 Unauthorized only occurring on some pages in Laravel 8

RuntimeException: Unable to create the cache directory (/var/www/sonata/app/cache/dev)

Passing a boolean value from checkbox in Laravel form

str_replace or preg_replace random number from string

sort() not affecting original array while inside foreach loop

How do I truncate a decimal in PHP?

Laravel: HTML in notification

Get latest Tweets - What API

Get orders by date and status woocommerce

About Contact Privacy policy Terms and conditions