Introduction
When it comes to building a Laravel application that requires social login functionality, managing user roles, and an admin panel, development from scratch can be a daunting task, especially for developers new to Laravel. Luckily, LaraSocial comes to the rescue, providing a starter template that includes everything needed to get started. In this review, I’ll be covering my experience with LaraSocial and whether it lives up to its promises.
Features and Functionality
Out of the box, LaraSocial includes full-featured social login functionality that supports multiple providers such as Facebook, Twitter, Google, LinkedIn, and GitHub. I was impressed to see that the social login integration was seamless and easy to implement, with no additional configuration required on the server side.
The package also comes with basic core features such as managing users, assigning user roles, and editing profile information. I found the UI to be user-friendly and intuitive, with clear navigation and minimal clutter. As an administrator, I was able to quickly and easily manage user accounts, assign roles, and monitor activity.
Admin Panel
One of the standout features of LaraSocial is the admin panel, which offers a wealth of information and functionality. With real-time user activity tracking, advanced user management, and customizable settings, administrators will have a comprehensive overview of user behavior and actions.
Value for Money
At zero cost, LaraSocial is an extremely affordable option for developers looking to enhance their Laravel application with social login capabilities. Considering the comprehensive features and functionality included in this package, it’s an absolute steal. In my opinion, the lack of a free trial or beta version is not a significant drawback given the excellent quality of the package and the promise of continuous updates and improvements from the developer.
Conclusion
Based on my experience with LaraSocial, I would highly recommend this package to any developer looking to incorporate social login and user management capabilities into their Laravel application. Its ease of use, comprehensive features, and extensive documentation make it an excellent choice. While the developer may consider adding free trial or beta versions in the future, it’s not a significant drawback given the excellence of this package.
Rating
Score: 10/10
Recommendation
If you’re looking for a reliable, user-friendly, and feature-packed Laravel package that supports social logins and user roles, look no further than LaraSocial. It’s an excellent choice that’s well worth the consideration of any developer looking to enhance their project with modern and robust capabilities.
User Reviews
Be the first to review “LaraSocial – Laravel Social Logins With User Role + Admin Panel”
Introduction
Social login has become an essential feature for modern web applications. It allows users to login to your application using their existing social media accounts, such as Facebook, Google, LinkedIn, Twitter, and many more. Laravel, being a popular PHP framework, has several social login packages that can help you achieve this. LaraSocial is one such package that provides a simple and easy-to-use interface for social logins, user roles, and an admin panel. In this tutorial, we will go through the process of setting up and using LaraSocial in a Laravel application.
Step 1: Installation
To install LaraSocial, you can use the following command in your terminal:
composer require larakit/larasocial
This will install the LaraSocial package and its dependencies.
Step 2: Configuration
Once installed, you need to configure LaraSocial by publishing its configuration file. Run the following command:
php artisan vendor:publish --provider="LarakitLaraSocialLaraSocialServiceProvider"
This will publish the configuration file config/larasocial.php
. Open this file and configure the social media providers you want to use. For example, to use Facebook login, you can add the following settings:
'facebook' => [
'client_id' => 'your_facebook_client_id',
'client_secret' => 'your_facebook_client_secret',
'redirect' => 'http://localhost:8000/login/facebook/callback',
],
Step 3: Route Configuration
Create a new route for social login using the following code:
Route::prefix('login')->name('login.')->group(function () {
Route::get('{provider}/redirect', 'LaraSocialController@redirect')->name('{provider}.redirect');
Route::get('{provider}/callback', 'LaraSocialController@callback')->name('{provider}.callback');
});
This code creates routes for social login redirection and callback.
Step 4: Login Controller
Create a new controller LaraSocialController
and add the following methods:
use AppHttpControllersController;
use LarakitLaraSocialFacadesLaraSocial;
class LaraSocialController extends Controller
{
public function redirect($provider)
{
return LaraSocial::redirect($provider);
}
public function callback($provider)
{
return LaraSocial::callback($provider);
}
}
These methods handle the social login redirection and callback.
Step 5: Admin Panel
LaraSocial provides an admin panel to manage user roles and permissions. To access the admin panel, go to http://localhost:8000/admin
and log in using your Laravel administrator credentials.
Step 6: User Role
LaraSocial provides user roles out of the box. You can manage user roles by going to http://localhost:8000/admin/roles
in your admin panel. You can create, edit, and delete user roles, as well as assign users to roles.
Step 7: Logout
To implement logout functionality, you can use the following code in your LogoutController
:
public function logout()
{
Auth::logout();
return redirect()->route('login');
}
This code logs out the user and redirects them to the login page.
Step 8: Displaying User Role
To display the user role, you can use the following code in your blade template:
@if(auth()->user()->role->name == 'admin')
You are an admin.
@endif
This code checks if the logged-in user is an admin and displays the corresponding message.
That's it! You have now successfully set up LaraSocial in your Laravel application. You can add more social media providers and user roles as needed.
Conclusion
LaraSocial is a powerful and easy-to-use package for social logins, user roles, and an admin panel. By following this tutorial, you can quickly integrate social login functionality into your Laravel application and provide a seamless user experience.
Here is a complete settings example for LaraSocial:
Database Settings
In the config/database.php
file, make sure the database
connection is set to the desired database. For example:
'connections' => [
'mysql' => [
'driver' => 'mysql',
'host' => 'localhost',
'database' => 'larasocial',
'username' => 'root',
'password' => '',
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => false,
'engine' => null,
],
],
LaraSocial Settings
In the config/larasocial.php
file, configure the social login settings. For example:
'providers' => [
'facebook' => [
'client_id' => 'your_facebook_client_id',
'client_secret' => 'your_facebook_client_secret',
'redirect' => 'http://localhost/larasocial/callback/facebook',
],
'google' => [
'client_id' => 'your_google_client_id',
'client_secret' => 'your_google_client_secret',
'redirect' => 'http://localhost/larasocial/callback/google',
],
],
'role' => [
'admin' => 1,
'user' => 0,
],
'admin_panel' => [
'prefix' => 'admin',
'namespace' => 'App\Http\Controllers\Admin',
],
Social Login Routes
In the routes/web.php
file, add the social login routes. For example:
Route::get('login/{provider}', 'LaraSocialControllersSocialController@redirectToProvider');
Route::get('login/{provider}/callback', 'LaraSocialControllersSocialController@handleProviderCallback');
Admin Panel Routes
In the routes/admin.php
file, add the admin panel routes. For example:
Route::group(['prefix' => 'admin', 'namespace' => 'AppHttpControllersAdmin'], function () {
Route::get('/', 'DashboardController@index');
Route::get('users', 'UserController@index');
});
Middleware
In the kernel.php
file, add the LaraSocialMiddlewareSocialMiddleware
to the $middleware
array. For example:
protected $middleware = [
//...
LaraSocialMiddlewareSocialMiddleware::class,
];
User Model
In the app/Models/User.php
file, add the LaraSocialTraitsSocialTrait
to the User
model. For example:
namespace AppModels;
use IlluminateDatabaseEloquentModel;
use LaraSocialTraitsSocialTrait;
class User extends Model
{
use SocialTrait;
}
Here are the features of LaraSocial - Laravel Social Logins With User Role + Admin Panel:
- 100% working social logins: All social login platforms are fully integrated and working with 100% accuracy.
- Manage Users: A comprehensive user management system to manage all user-related data.
- User Roles: Assign roles to users, including admin, editor, and user, to control access to different areas of the application.
- Awesome Full Featured Admin Panel: A fully functional and user-friendly admin panel to manage the entire application.
- Starter Template: A complete starter template for building social login-based applications with ease.
Additionally, the following information can be extracted:
- Demo links:
- Admin Demo: https://vwebtech.com/larasocial/login (login credentials: admin@gmail.com, admin123)
- Editor Demo: https://vwebtech.com/larasocial/login (login credentials: editor@gmail.com, editor123)
- User Demo: https://vwebtech.com/larasocial/login (login credentials: user@gmail.com, user1234)
- Contact information:
- Email: v4webtech@gmail.com
- Skype/WhatsApp: +91 8866041242
$25.00
There are no reviews yet.