1. Go to this page and download the library: Download autn/gcl-users library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namespace App;
// ...
use Illuminate\Auth\Authenticatable;
use Illuminate\Auth\Passwords\CanResetPassword;
use Illuminate\Contracts\Auth\Authenticatable as AuthenticatableContract;
use Illuminate\Contracts\Auth\Access\Authorizable as AuthorizableContract;
use Illuminate\Contracts\Auth\CanResetPassword as CanResetPasswordContract;
use Gcl\GclUsers\Models\User as GclUser;
class User extends GclUser implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract
{
use Authenticatable, CanResetPassword;
// ...
// You need allows fill attributes as follows
protected $fillable = [
'name',
'email',
'password',
'username',
'location',
'country',
'biography',
'occupation',
'website',
'image',
'birthday',
'gender'
];
// ...
}
namespace App;
// ...
use Gcl\GclUsers\Models\UserTrait;
class User extends GclUser implements AuthenticatableContract, AuthorizableContract, CanResetPasswordContract
{
use UserTrait, Authenticatable, CanResetPassword; // add this trait to your user model
// ...
}
// create role admin (default this role has been created on UserModuleSeeder)
$admin = new Role();
$admin->name = 'admin';
$admin->display_name = 'User Administrator'; // optional
$admin->description = 'User is allowed to manage and edit other users'; // optional
$admin->save();
// role attach alias
$user->attachRole($admin); // parameter can be an Role object, array, or id
// or eloquent's original technique
$user->roles()->attach($admin->id); // id only
// create permission
$createPost = new NodePermission();
$createPost->name = 'create-post';
$createPost->display_name = 'Create Posts'; // optional
$createPost->description = 'create new blog posts'; // optional
$createPost->parent_id = 1 // optional
$createPost->save();
$admin->attachPermission($createPost);
// equivalent to $admin->perms()->sync(array($createPost->id));
<h3>You are receiving this e-mail because you requested resetting your password to domain.com</h3>
Please click this URL to reset your password: <a href="http://domain.com/passwords/reset?token={{$token}}">http://domain.com/passwords/reset?token={{$token}}</a>