Header Ads

Create Authentication(Register,Login,Logout) in Laravel


Laravel makes implementing authentication very simple. In fact, almost everything is configured for you out of the box. The authentication configuration file is located at config/auth.php.


Laravel used to have a scaffold for this out of the box.For implementing Authentication in Laravel Simply type an artisan command. It will create all of the necessary view and route for you.

To create Authentication Simply types the following command.

php artisan make:auth

This Command will reply with all of your the necessary views finally reply Authentication scaffolding generated successfully.

Now we can see the all of the views are generated like
  • welcome.blade.php is the public welcome page 
  • home.blade.php - the dashboard for logged-in users 
  • auth/login.blade.php - the login page 
  • auth/register.blade.php - the register/signup page 
  • auth/passwords/email.blade.php - the password reset confirmation page 
  • auth/passwords/reset.blade.php - the password reset prompt page 
  • auth/emails/password.blade.php - the password reset email
And we have a Layout (resources/views/layouts/app.blade.php) that is the core of this scaffold.


Our public welcome page(welcome.blade.php) is still routed via routes.php:
Route::get('/', function () {
    return view('welcome');
});
And we now have a HomeController, which route is our dashboard:
class HomeController extends Controller
{
    /**
     * Show the application dashboard.
     *
     * @return Response
     */
    public function index()
    {
        return view('home');
    }
}
This is of course routed in routes.php in the web group. And notice that there's something else new there: The Route::auth() method:
Route::group(['middleware' => 'web'], function () {
    Route::auth();

    Route::get('/home', '');
});
You can learn more about Authentication in Laravel from bellow video. 


2 comments:

  1. Could you suggest anything regarding Online Payment Gateway system?

    ReplyDelete
  2. WoorPlay Slots - Casino Review - Virtual casino in Asia - wooricasinos
    WO'S BEST mobile bet365 CASINO · Experience the world's most 포커 규칙 prestigious 넷텔러 and thrilling live casino games · Experience the thrill of the 룰렛 규칙 Las Vegas strip. · Play & Win · Experience 스포츠스코어 the

    ReplyDelete

Powered by Blogger.