In the previous tutorial, we talked about guards and create an admin guard with complete login functionality. Now we will learn about middleware and customize the Authenticate and RedirectIfAuthenticated middleware for our admin guard. We will also use login throttling and lastly password reset.
Whenever you want to use middleware like auth and guest for admin guard then you can use a colon between them e.g “auth:guard”. Now Open your LoginController and add:
This will specifically look for the admin guard and nothing else so guest means that the admin is not logged in and it doesn’t care if a user from web guard is logged in or not. …
In this tutorial, we will build a multiple guards authentication allowing users and admins to login separately. This will be 2 parts series because we do have quite a bit of work to do and I will be explaining all the things that you need to know about custom authentication. Let’s get started.
Let’s start by creating a new laravel project with composer:
composer create-project laravel/laravel multiauth
First thing we will do is add the database credentials to the .env …
In the previous tutorial, we had implemented authentication, email verification and password reset. We also learned about implementing manual authentication, middleware, and used mailtrap for sending reset and verification emails. Now what we want to do is create a new column “user_id” and relate it to users table with a foreign key so a user can only access his/her todos and not other todos. We will implement one to many and one to many (inverse) relationship. …
In the previous tutorial, we talked about Database Migrations, Config, and Todos CRUD with Eloquent Models. This tutorial is all about Authentication. We will create a full Authentication System with Email Verification and Password Reset.
Laravel comes with a complete authentication system right out of the box, where users can register/login, reset their passwords , etc. There are some things to consider when implementing authentication with laravel. Laravel includes a User model which will be used for default authentication driver for users. We already have all the controllers in app/Http/Controllers/Auth and laravel also includes migrations for users and password_resets table. To implement auth all we have to do is run make:auth command. It will create all the views in resources/views directory and add routes in our web.php …
In the previous tuturial, We talked about laravel framework, How to install it, An introduction to MVC architecture, Created routes, controllers. and views. In this tutorial, we will talk about Models, Database Migrations and make CRUD (CRUD means Create, Read, Update, and Delete from a database) operations on todos table with MySQL.
Before creating migrations, We will need to setup our database, assuming you know how to create a database using phpmyadmin. After creating the database, we will add the database credentials in our application. Laravel has a .env environment file which will have all the sensitive data like database credentials, mail driver credentials, etc because it’s not recommended to store such information directly inside the code (environment files are not limited to PHP. They are used in all other major frameworks). Values inside the .env files are loaded inside the files from the config directory. .env file is located at the root of our application. Let’s take a look at the file (Below is not the complete env file. …
In this series, We will make a basic (but rich in functionality) todo application with Laravel 5.8. The main purpose of this series is to get started with Laravel. You will be learning all the basic and important parts of this framework. Let’s get started.
Laravel is the most popular PHP framework built by Taylor Otwell and community. It uses MVC architecture pattern. It provides a lot of features like a complete Authentication System, Database Migrations , A Powerful ORM, Pagination, and so on. Before creating the application, you will need to have PHP 7.2 and MySQL (we are not using apache in this series) and composer installed. I use xampp which is a package that comes with PHP, MySQL, and Apache. Composer is a dependency manager for PHP. It’s similar to npm which is a dependency manager for Javascript. …
We are building Facebook login app with Laravel using Socialite package. I will be explaining all the things but it would be good if the reader knows at least the basics of Laravel. Let’s start by creating a project (make sure you have composer and xampp installed):
composer create-project laravel/laravel facebook-login
Socialite is a Laravel package that handles 0Auth logins. Socialite supports authentication with Facebook, Twitter, LinkedIn, Google, GitHub, GitLab and Bitbucket. There are socialite adapters for other platforms. Let’s install it:
composer require laravel/socialite
Create a database in MySQL and add the credentials in the .env file. Open the users migration file located in database/migrations directory and update the up()…
In this tutorial, we will implement Push Notifications feature in our Laravel app using WebPush. We will use Vanilla Javascript with no frameworks or libraries. Push Notification is a feature of Service Workers. A Service Worker is a script inside the web browser that runs in the background. There are a lot of features like caching , background syncing but this tutorial is only about Push Notifications. We will also implement push notifications for guest users.
Note: Service Workers use HTTPS unless you are using localhost.
Let’s create a new laravel project with composer:
composer create-project laravel/laravel webpush
Before migrating table add this line in the boot() method of your AppServiceProvider.php located in app\Providers…
About