Console Commands

Create user

You can create a new user via command line using below command, then follow instruction on screen, it will be asked name, username, email, password and user role.

$ php artisan laraloop:create-user 

Method signature of this command is:

'laraloop:create-user 
    {name?          : The name of user} 
    {email?         : The email of user} 
    {username?      : The username of user} 
    {password?      : The password of user}
    {--role=        : The role of user}                  
    {--force        : Save user without asking confirmation}';

Update user

For update user with ID 1 run below command.

$ php artisan laraloop:update-user --id=1

The --id option is not mandatory, if you omitt it then will be asked.

Method signature of this command is:

'laraloop:update-user 
      {name?              : The name of user} 
      {email?             : The email of user} 
      {username?          : The username of user}
      {--id=              : The ID of user to update}
      {--role=            : The role of user}                  
      {--force            : Save user without asking confirmation}                  
      {--all              : Ask to update all attributes}                  
      {--columns=         : Add which columns want to update separated by comma}                 
      {--novalidate       : Skip validation}';

The command will do some validations, but not for everything since there are some limitation using validation via console command.

Seed users

With Laraloop you can seed users for testing purpose. Below is basic console command, then you can follow instruction on screen.

$ php artisan laraloop:seed-users

Method signature:

'laraloop:seed-users
      {max?              : Max number of users to seed.}
      {perDay?           : Max number of users to seed per day. The actual number will be random between half and perDay.}
      {--active          : Only active users, not deleted and verified.}';

NOTE: option perDay it's useful to seem statistics in admin area. If you skip this, then all users will be created today as created date. Since statistics use created_at you will see all users in today date.

Delete expired bans

When you ban a user you can set an expiration date, below command allow you to delete expired ban. It's optional and you can use it to clean ban table. Otherwise you can keep tracks of users ban history.

$ php artisan laraloop:delete-expired-ban

CRUD Generator

1. Via JSON

$ php artisan infyom:scaffold $MODEL_NAME --fieldsFile=$SCHEMA_FILE.json
$ php artisan migrate

2. Rollback

$ php artisan infyom:rollback $MODEL_NAME $COMMAND_TYPE
$ php artisan infyom:rollback $MODEL_NAME $COMMAND_TYPE --views=edit,create,index,show

Example

$ php artisan infyom:rollback Post scaffold

3. Generate Migration or model

$ php artisan infyom:migration $MODEL_NAME
$ php artisan infyom:model $MODEL_NAME

4. Generate Controller for Api

php artisan infyom.api:controller $MODEL_NAME

5. Generate requests

$ php artisan infyom.api:requests $MODEL_NAME

6. Generate Controller CRUD

$ php artisan infyom.scaffold:controller $MODEL_NAME

7. Generate Views

$ php artisan infyom.scaffold:views $MODEL_NAME

Install command

With the install command you can setup Laraloop or also re-create database and seed required data such as roles, permissions and admin users.

The command signature is:

'laraloop:install
        {--db        : Re-install database.}
        {--force     : Force publishing by overriding}';

Run first time you install laraloop:

$ php artisan laraloop:install

Recreate database:

$ php artisan laraloop:install --db

The install command will ask if publish views, assets, etc. If you have already published something, you can force to override files. This will override any changes you made so be careful.

$ php artisan laraloop:install --force