Background Image

Module Manager

Module Manager is a tool to create New Modules, Edit Modules by Adding & Editing Fields/Columns and Manage them with Role Access Control. Inspired by Philosophy of SugarCRM it has completely Modular Approach and support fields with advanced data types. Once you are done editing Module You can generate CRUD's simply clicking a Button.

You can open Module Manager by Modules Option shown in Top Navbar or by url /admin/modules

LaraAdmin Module Manager Link

Once you open Module Manager you will see all the system Modules Listed there. In actions you will see option to

  • Edit Module - Edit Module Fields
  • Module Access Control - Module & Module Field Access for Roles
  • Module Field Sorting - Sort Module Fields for Form Views
  • Module Deletion - Deletes Database + CRUD's
LaraAdmin Module Manager Index View

Create a Module

You can simply create a Module with its Name and Icon. You can choose Module name One word or Multi Word. We recommend to choose Module name as Noun and should be Plural. e.g. Courses, System Handlers, User Orders. It is because we use Laravel function like str_plural, str_singular to generate Controller, Model and Database Table names.

LaraAdmin Create Module Form

Once you created a Module it will not create a actual table but a Schema in modules table. When you create first field of Module then the module table will be created.

Icon represent the View Column which will be used as anchor in Course Listing to view Detailed Course Info. Without setting this you cannot generate the Module. Module Header show Red Background because CRUD's not generated for this Module.

LaraAdmin Create Module Index Page
Things to know:
  1. LaraAdmin uses two database tables to manage the Module Schema: modules which stores information about module such as database name, controller name, icon and module_fields which stores schema for fields. Please have look at them once.
  2. LaraAdmin is divided into two parts for its working:
    1. Part of code which comes in your project (UI + Built-in Modules) after la:install
    2. Remaining code (Business Logic) which lies in dwij/laraadmin package which will be there in /vendor/dwij/laraadmin
  3. Check more about How LaraAdmin works ? in Architecture section.

Add Module Fields

Next step is to create Module Fields. The first Module Field should be a Name / Title.

LaraAdmin Create Module Field Name
Field
Description
Field LabelLabel of Column e.g. Name, Cost, Is Public
Column NameDatabase column name. lowercase, words concatenated by underscore (_)
UI TypeIt defines type of Column in more General way. Please see table for UI Types.
UniqueWhether the column has unique values. Value in true / false
Default ValueDefault value for column.
MinimumMinimum Length of value in integer.
MaximumMaximum Length of value in integer.
RequiredIs this mandatory field in Add / Edit forms. Value in true / false
Values This is for MultiSelect, TagInput and Radio Columns. Firstly you need to decide whether you want to give values manually in List or from Database Tables. LaraAdmin Module Field Popup Values - Tables

Popup Values from Database tables with foreign keys. Here Default value should be integer.

LaraAdmin Module Field Popup Values - List

Popup Values from Editable List. Here Default value should be blank or value from Values List.

UI / Data Types

There are around 24 Data Types supported as of now. There will be more in future.

Data TypeDefault ValueMinimumMaximumPopup Values
AddressIn StringIntegerInteger
Checkboxtrue / false00
CurrencyIn DecimalMinimum ValueMaximum Value
Datenow()
2016-06-23
00
Datetimenow()
2016-06-23 14:20:90
00
DecimalIn DecimalMinimum ValueMaximum Value
DropdownString--[ Array List ]
Integer@ Database Table
EmailIn StringIntegerInteger
FileFile Path (String)0256
FloatIn FloatMinimum ValueMaximum Value
HTMLIn String00
ImageImage Path (String)0256
IntegerIn IntegerMinimum ValueMaximum Value
MobileIn String020
MultiselectString-Max Selections[ Array List ]
Integer@ Database Table
NameIn String5256
PasswordIn String6256
RadioString--[ Array List ]
Integer@ Database Table
StringIn String0 Integer256 Integer
Taginput[ Array List ]Min SelectionsMax Selections[ Array List ]
@ Database Table
TextareaIn String0 Integer1000 Integer
TextFieldIn String5 Integer256 Integer
URLIn String0Default 256

Generate CRUD's

Once you created all fields, you need to select View Column using icon in front of desired column. Most probably Name or Title. Once you do that you can generate CRUD's just by clicking button Generate Migration + CRUD. After this you can see Module background to be Green.

Generated CRUD's:
  1. Controller - CoursesController.php
  2. Resource Routes for CoursesController in admin_routes.php
  3. Model - Course.php
  4. Migration - create_courses_table for migration purpose
  5. Views - index.blade.php, edit.blade.php, show.blade.php
Things to know:
  1. Your db table courses was generated and manipulated simultaneously when you created first field Name.
  2. Once CRUD's are generated you can directly access it from /admin/courses. But in Laravel testing mode you need another request to access it as admin_routes.php has to be loaded again with new routes we added programmatically.

Edit Module Fields

LaraAdmin provides dynamic Field editing which doesn't need migrations to be refreshed. You can simply click on Edit Field button and start editing field.

You can also change field types such as Dropdown, Multiselect, Radio, Taginput which are connected to other modules / tables via foreign keys. LaraAdmin will automatically call $table->dropForeign and easily switches linked tables.

Once you are done with all editing you can get your migration file updated via Update Migration button on Module page. This will help you create the exact table again in next installation.


Is this content useful ?

What's Next ?