Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Laravel 5 Essentials

You're reading from   Laravel 5 Essentials Explore the fundamentals of Laravel, one of the most expressive and robust PHP frameworks available

Arrow left icon
Product type Paperback
Published in Apr 2015
Publisher Packt
ISBN-13 9781785283017
Length 144 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Martin Bean Martin Bean
Author Profile Icon Martin Bean
Martin Bean
Arrow right icon
View More author details
Toc

Authenticating users


Allowing users to register and sign in is an extremely common feature in web applications. Yet, PHP does not dictate how it should be done, nor does it give you any helpers to implement it. This has led to the creation of disparate, and sometimes insecure, methods of authenticating users and restricting access to specific pages. In that respect, Laravel provides you with different tools to make these features more secure and easier to integrate. It does so with the help of its authentication service and functionality that we have not covered yet—middleware.

Creating the user model

First of all, we need to define the model that will be used to represent the users of our application. Laravel already provides you with sensible defaults inside config/auth.php, where you can change the model or table that is used to store your user accounts.

It also comes with an existing User model inside app/User.php. For the purposes of this application, we are going to simplify it slightly...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image