laililmahfud / adminportal
A Simple CRUD Generator - Automatically generate simple CRUD modules.
Installs: 123
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 1
Forks: 1
Open Issues: 0
Type:package
Requires
- php: ^8.0.2
- barryvdh/laravel-dompdf: ^2.0
- firebase/php-jwt: ^6.3
- laililmahfud/apdoc: ^0.0.6
- maatwebsite/excel: ^3.1
This package is auto-updated.
Last update: 2024-04-23 02:56:31 UTC
README
Automatically generate simple CRUD module
🔍 About AdminPortal
Adminportal is a simple crud module generator for Laravel by making it easy for developers to customize the appearance of the generated modules. By providing several built-in features that will make it easier and faster for developers to build applications.
🔑 License
Adminportal is under MIT License
📖 Table Of Contents
- Installation
- Usage
- Configuration
- Create Module
- CRUD Controller Configuration
- Form Component
- Question
⬇️ Installation
Requirement
- Web Server
- Nginx
- Apache
- Database that laravel supports, actually can be :
- MySQL
- Postgres
- SQLite
- SQL Server
- Composer
- Laravel ^8.0
- PHP ^8.0
Installation Instruction
- Please make sure you have install laravel project, please follow https://laravel.com/docs
- Open the terminal, navigate to your laravel project directory and
composer require laililmahfud/adminportal
- Setting the database configuration, open .env file at project root directory
- Run the following command at the terminal
php artisan adminportal:install
- After the installation process is complete, you will be given an account to enter the backend page
- default email : portal@admin.com
- default password : P@ssw0rd
- backend url : /admin
- Enjoy Your Code 🧑💻
👋 Usage
Useful Commands
You can run 👇
# | Artisan Command | Usage |
---|---|---|
1 | php artisan adminportal:api-key |
Generate api and jwt key |
2 | php artisan adminportal:migration |
Migrate admin portal table requirement |
Global Helper Functions
# | Function | Usage |
---|---|---|
1 | portalconfig |
Function to get adminportal config |
2 | admin |
Return current users session data |
3 | itcan |
The function of checking user role permissions |
🎮 Configuration
User Management
By default the user login table uses the admin cmd table and when you enter the backend with the default user given, there will be a menu
➡️ User Management ➡️ User Admin
In that menu you can add new user data according to your needs.
Role & Permission
➡️ User Management ➡️ Roles & Permission
By default you will be given the default Super Admin role with the super admin yes flag which can access the entire module.
Application Configuration
You can see application settings in the config/adminportal.php file List of application configuration
admin_path
: This will be used to register the route prefix to access the backend pageapp_icon
: Path of icon asset, this will be used for the login page logo as well as the backend sidebarapp_favicon
: This is application favicon pathdefault_avatar
: This will be used to be the default avatar profile of the applicationlogin
: Configuration for login viewview_path
: Base resource path login viewbanner
: Image banner for login viewbanner_title
: Banner title for login viewbanner_description
: Banner description for login viewlimiter
: Limiter middleware to limit excess login function accessurl
: Default url for login page, change if you want custom view and implement your own routeforgot_password_url
: Default url for forgot password page, you must implement your own function to use it, set null to remove Forgot Password link in login pageregister_url
: Default url register page, you must implement your own function to use it, set null to remove Register link in login page
theme_color
: Application primary color for sidebar and some buttonauth
: For auth session managementsession_name_prefix
: To set session auth backend prefixlogout_url
: Default logout url for backend, change if you want custom and implement your own function
profile_url
: Default url for admin profile page, change if you want custom and implement your own functionnotification
: For display dropdown notification on headerdisplay
: Set false to hide dropdown notification on headerinterval
: Interval request get notification list, set null to disable interval requestpath
: Default url see all notificationajax_path
: Ajax url interval request get notification list
alert_message_type
: For display alert after action, available popup or alertapi
: For API Configurationsecret_key
: API Secret keyjwt_secret_key
: JWT secret key for generate JWT token,expired_duration_get_token
:validate_blacklist
: Set tru if you want blacklist token after logout api
📺 Create Module
New CRUD Module
-
First create your migrate table or use existing table. Your table must have an id column and a uuid column
-
Go to Module Management menu then go navigate to GENERATE NEW MODULE button
Step 1 - Configuration
- Table
- The table that you will use for the module to be created.
- Module Name
- The name of the Module / Menu to be generated
- Module Path
- Url of the module, by default admin prefix will be added (based on settings)
- Controller Name
- The name of the controller to be created, the controller will be stored in the
app > Http > Controllers > Admin
folder
- The name of the controller to be created, the controller will be stored in the
- Module Icon
- Icon of the menu to be used in the sidebar. We use iconsax in the whole application. You can see more detailed list of icons here
- Configuration
- Bulk Action?
- You can tick to display activate the bulk-action function in the list table
- Create?
- You can tick to display Add button in table view
- Edit?
- You can tick to display Edit button in list of data table
- Filter?
- You can tick to display Filter button in table view
- Import?
- You can tick to display Import button in table view
- Export?
- You can tick to display Export button in table view
- Bulk Action?
Step 2 - Table View
- Label
- Label of row table
- Name
- The field name according to the current table
- Join (Optional)
- Join relation table
Step 3 - Form View
- Label
- Label of form field
- Name
- Name of form field
- Type
- Type of form field
- Rule
- Rules validation for store and update function
- Create Rule
- Rules validation for store function only
- Update Rule
- Rules validation for update function only
- Table
New Static Module
Just go to Module Management menu, and on the right side of the card you will find the Create Static Menu form to create a new static module
⚓️ CRUD Controller Configuration
Available configuration for controller
protected $routePath
- Route base name for the controller module | String
protected $pageTitle
- Module title on the screen page | String
protected $resourcePath
- Base resource path for the module | String
protected $moduleService
- Service class for handling crud function | Class
protected $importExcel
- Import class for handling import excel function (using laravel excel) | Class
protected $tableColumns
- List of main table view column | array
protected $rules
- Rules validation for store and update function | array
protected $createRules
- Rules validation for store function only | array
protected $updateRules
- Rules validation for update function only | array
protected $add
- Indicates if the user can add record, this will display add button | boolean
protected $filter
- Indicates if the user can filter record, this will display filter button | boolean
protected $import
- Indicates if the user can import record, this will display import button | boolean
protected $export
- Indicates if the user can export record, this will display export button | boolean
protected $bulkAction
- Indicates if the user can do bulk action of the record, this will display checkbox in the table | boolean
protected $tableAction
- Indicates if the table has action function, this will show action column table | boolean
protected $perPage
- The paginate per page item list | integer
protected $data
- The variable for assign data to view | array
protected $message
- Custom message actions | array
- store
- Custom alert message for store success function
- failed_store
- Custom alert message for failed store function
- update
- Custom alert message for update success function
- failed_update
- Custom alert message for failed update function
- delete
- Custom alert message for delete success function
- failed_delete
- Custom alert message for failed delete function
- bulk_delete
- Custom alert message for bulk delete success function
✨ Form Component
-
input (text,time,date,email,number)
<x-portal::input type="text" name="name_of_input_request" label="Label" placeholder="Placeholder" horizontal></x-portal::input>
-
checkbox
<x-portal::input.checkbox name="name_of_input_request" label="Label" horizontal> <x-portal::input.checkbox.option class="me-5" checked name="name_of_input_request" label="Sample option" value="1"></x-portal::input.checkbox.option> </x-portal::input.checkbox>
-
image
<x-portal::input.image name="name_of_input_request" label="Label" placeholder="Placeholder" horizontal></x-portal::input.image>
-
radio
<x-portal::input.radio.group name="name_of_input_request" label="Label" horizontal> <x-portal::input.radio.group.option checked class="me-4" name="name_of_input_request" label="Option" value="Option"></x-portal::input.radio.group.option> </x-portal::input.radio.group>
-
select
<x-portal::input.select name="name_of_input_request" label="Label" placeholder="Placeholder" horizontal> <option value="">Label</option> </x-portal::input.select> <x-portal::input.select.asset />
-
wysiwyg
<x-portal::input.wysiwyg name="name_of_input_request" label="Label" placeholder="Placeholder" horizontal></x-portal::input.wysiwyg>
-
password
<x-portal::input.password name="name_of_input_request" label="Label" placeholder="Placeholder" horizontal></x-portal::input.password>
-
textarea
<x-portal::input.textarea name="name_of_input_request" label="Label" placeholder="Placeholder" horizontal></x-portal::input.textarea>
🙋♂️ Question
If you have any question just submit in github issue here