Comments (2)
we used to create an artisan command (laravel) that ask the user data and create the user with the Sentinel facade.
...
public function handle()
{
$username = $this->ask(_i('Correo electrónico del usuario:'));
$password = $this->secret(_i('Contraseña:'));
$repeatPassword = $this->secret('Repita la contraseña');
$credentials = [
'login' => $username,
'password' => $password,
];
if ($password === $repeatPassword) {
$response = \Sentinel::registerAndActivate($credentials);
$names = $this->ask('Ingrese sus nombres');
$lastNames = $this->ask('Ingrese sus apellidos');
$user = \Sentinel::findById($response->id);
$user->superuser = 1;
$user->save();
Profile::create([
'first_name' => $names,
'last_name' => $lastNames,
'user_id' => $user->id
]);
$this->info('Se ha creado su usuario correctamente');
}
else {
$this->error('Las contraseñas no coinciden');
}
}
...
from sentinel.
Thanks @Mxrck that was really useful! :)
from sentinel.
Related Issues (20)
- Using Sentinel statelessly without starting session HOT 3
- Prevent Users from getting same Sesstion ID
- i cant use middleware auth or guest inside of my routes HOT 3
- [Proposal] Incomplete installation guide - Add hint to install database schema HOT 1
- How do I get Sentinel to authenticate checking additional fields? HOT 2
- HasAccess function return false if a user have multiple roles and different permission HOT 8
- Prefix in database tables
- PostgreSQL ERROR: operator does not exist: boolean = integer HOT 3
- registerAndActivate on a different connection doesn't work with config() HOT 5
- Cartalyst\Sentinel\Users\EloquentUser::getUserId(): Return value must be of type int, null returned
- illuminate/ packages older version HOT 1
- Activation::complete method returns PHP Fatal error: Uncaught RuntimeException: A facade root has not been set error
- Support for Laravel 9.6 and PHP 8.* HOT 2
- Authenticate using username or email
- unable to login HOT 2
- Laravel 10 Support HOT 4
- Deprecation warnings HOT 1
- Question: does it support user impersonation?
- support laravel 11 HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sentinel.