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 (
1.) Add new module called "VoipMon"
php artisan module:make VoipMonCommit: ee4935f
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
3.) Add database migration
php artisan module:make-migration create_Cdr_table VoipMonCommit: c8c2225
3.1.) Change the default migration according to your needs (extends BaseMigration)
Commit: 06ca7dc
3.2.) Run the migration
php artisan module:migrate VoipMon4.) Add database seeder (not used here, extends BaseSeeder)
php artisan module:make-seed Cdr VoipMonand change it according to your needs
5.) Add model according to the database table
php artisan module:make-model Cdr VoipMonCommit: 795f808
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
6.) Add controller
php artisan module:make-controller Cdr VoipMonCommit: ef16e82
6.1.) Change the default controller according to your needs (extends BaseController)
comment index() function to use the one from the BaseController
Commit: b6acf55
7.) Add header and route to controller
Commit: 519f79f
8.) Add artisan module command
php artisan module:make-command matchRecordsCommand VoipMonCommit: 3a6387a
8.1) Change the default module according to your needs (extends BaseController)
Commit: 80cb36f
9.) Implement Edit View of Controller
Commit: 04eb454
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."