acacha/users

User managment with Laravel and adminlte-laravel

dev-master / 1.0.x-dev 2017-12-18 15:38 UTC

README

Latest Version on Packagist Total Downloads Monthly Downloads Daily Downloads Software License Build Status Coverage Status Quality Score Total Downloads StyleCI Code Coverage Dependency StatusDependency Status Node.js

Acacha users is a Laravel package that add Users managment support yo your Laravel app.

Installation

Via Composer please first create a new fresh Laravel Project:

laravel new laravel_with_users
cd laravel_with_users

Install adminlte-laravel template with:

adminlte-laravel install

Then install this Laravel Package using:

composer require acacha/users

Now install Javascript Vue components using:

npm install --save acacha-users

Modify your app.js Bundle to use acacha-users Vue components adding:

//Acacha Users management components
require('users-bootstrap');

Just after Vue installation. Now compile with:

npm install
npm run dev

Install also Spatie Laravel Permission Package:

composer require spatie/laravel-permission
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="migrations"
php artisan vendor:publish --provider="Spatie\Permission\PermissionServiceProvider" --tag="config"
php artisan migrate

Configure App\User adding the following traits:

class User extends Authenticatable
{
    use Notifiable, HasRoles, HasApiTokens, ExposePermissions, RevisionableTrait,HasUserMigrations;

Also install spatie/laravel-menu usign wizard:

php artisan adminlte:menu

Use llum boot to run migrations and other common firt execution tasks:

llum boot

Finally assure Laravel Passport (https://laravel.com/docs/5.5/passport) is installed and configured. Composer package is a dependency so no need to install explicitly but be sure to add CreateFreshApiToken midleware to Http/Kernel.php file

protected $middlewareGroups = [
        'web' => [
        ...
        \Laravel\Passport\Http\Middleware\CreateFreshApiToken::class,
        ],

And change auth configuration to use passport:

'guards' => [
        ...
        'api' => [
            'driver' => 'passport',
            'provider' => 'users',
        ],
    ],

Installation on development

Via Composer please first create a new fresh Laravel Project:

laravel new laravel_with_users
cd laravel_with_users

Install adminlte-laravel template with:

adminlte-laravel install

Install Studio (https://github.com/franzliedke/studio) on your system or use Composer path repositories (https://getcomposer.org/doc/05-repositories.md#path)

With Composer Path repositories add in composer.json file just before require section

"repositories": [
        {
            "type": "path",
            "url": "./users"
        },
        {
            "type": "path",
            "url": "./users-ebre-escool-migration"
        }
    ],

Create folders users and users-ebre-escool-migration with packages (you can clone it):

https://github.com/acacha/users
https://github.com/acacha/users-ebre-escool-migration

Then install this Laravel Package using:

composer require acacha/stateful-eloquent:dev-master
composer require acacha/users:dev-master
composer require scool/ebre_escool_model:dev-master
composer require acacha/users-ebre-escool-migration:dev-master

Now is time to configure npm dependencies. Modify file webpack.mix.js adding:

  .js .....
  .sourceMaps()
  .webpackConfig({
    resolve: {
      modules: [
        path.resolve(__dirname, './users/resources/assets/js'),
        path.resolve(__dirname, './users-ebre-escool-migration/resources/assets/js'),
        path.resolve(__dirname, 'node_modules')
      ]
    }
  })

Compile Javascript bundle with Laravel Mix/webpack:

npm install
npm run dev

Requirements

  • Laravel
  • Spatie Laravel permission package
  • Acacha AdminLTE Laravel template
  • Javascript npm packages
    • Vue
    • Axios
    • adminlte-vue
    • vuetable-2
    • password-generator
    • vue-events (TODO migrate to Vuex Store!)
    • vue-scrollto

Vuetable-2 problem with transform-runtime (see also http://acacha.org/mediawiki/Vuetable2):

npm install --save-dev babel-plugin-transform-runtime babel-preset-stage-2

Tests

Add the suites to phpunit.xml file:

<testsuite name="Users">
    <directory suffix="Test.php">./users/tests/Feature</directory>
</testsuite>
<testsuite name="UsersEbreEscoolMigration">
    <directory suffix="Test.php">./users-ebre-escool-migration/tests/Feature</directory>
</testsuite>

And run phpunit.

Usage

$skeleton = new Acacha\Users();
echo $skeleton->echoPhrase('Hello, League!');

Change log

Please see CHANGELOG for more information what has changed recently.

Testing

$ composer test

Contributing

Please see CONTRIBUTING and CONDUCT for details.

Security

If you discover any security related issues, please email sergiturbadenas@gmail.com instead of using the issue tracker.

Credits

TODO Javascript/Npm dependencies

License

The MIT License (MIT). Please see License File for more information.