Write your own Application

Write your own Application

This is intended to be a step-by-step guide for creating a new module. It is based on the VoipMon module (

Error rendering macro 'jira' : Unable to locate Jira server for this macro. It may be due to Application Link configuration.
)

1.1. 1.) Add new module called "VoipMon"

php artisan module:make VoipMon

Commit: ee4935f

1.2. 2.) Use external database generated by voipmonitor daemon (only if external database will be used)

  • add new database entry to connections in config/database.php

  • add used variables to .env

Commit: 0c55073

1.3. 3.) Add database migration

php artisan module:make-migration create_Cdr_table VoipMon

Commit: c8c2225

1.3.1. 3.1.) Change the default migration according to your needs (extends BaseMigration)

Commit: 06ca7dc

1.3.2. 3.2.) Run the migration

php artisan module:migrate VoipMon

1.4. 4.) Add database seeder (not used here, extends BaseSeeder)

php artisan module:make-seed Cdr VoipMon

and change it according to your needs

1.5. 5.) Add model according to the database table

php artisan module:make-model Cdr VoipMon

Commit: 795f808

1.5.1. 5.1.) Change the default model according to your needs (extends BaseModel)

implement:

  • view_headline()

  • rules()

  • view_index_label()

  • all relations to other tables (e.g. view_belongs_to(), view_has_many(), ...) --> Commit: e702a50

Commit: 97ab080

1.6. 6.) Add controller

php artisan module:make-controller Cdr VoipMon

Commit: ef16e82

1.6.1. 6.1.) Change the default controller according to your needs (extends BaseController)

comment index() function to use the one from the BaseController

Commit: b6acf55

1.7. 7.) Add header and route to controller

Commit: 519f79f

1.8. 8.) Add artisan module command

php artisan module:make-command matchRecordsCommand VoipMon

Commit: 3a6387a

1.8.1. 8.1) Change the default module according to your needs (extends BaseController)

Commit: 80cb36f

1.9. 9.) Implement Edit View of Controller

Commit: 04eb454

1.9.1. Laravel Internals

We use Laravel Modules to support basic module usage. "A Laravel Module is like a laravel package, it have some views, controllers or models."