- Setting Management System
Run Composer Require Command
composer require doctype_admin/settings
php artisan migrate
To use specific seed use(publish them first)
php artisan db:seed --class=SettingsTableSeeder
php artisan DoctypeAdminSetting:install -a
This command will publish
- config file named Setting.php
- views files of setting
- migrations files
- seed files
php artisan DoctypeAdminSetting:install -c
php artisan DoctypeAdminSetting:install -f
php artisan DoctypeAdminSetting:install -m
php artisan DoctypeAdminSetting:install -d
If seed class is not found try running composer dump-autoload
To add the package route link to be accesable from sidemenu just add following on config/adminlte.php under key 'menu'
[
'text' => 'Setting',
'icon' => 'fas fa-cog',
'url' => 'admin/setting'
],
- Text Field
- Rich Textarea
- Image
- Select
- Radio
- Checkbox
We can access setting's assigned value globally by simply using blade directive like
{{@setting('setting_name')}} // setting_name is one you make while you are creating setting (should be lower cap with space replaced by underscore(_) : Recommended)
if we have a setting and you name that setting "Site name" then to use the value assigned to that setting use
{{@setting('site_name')}}
It uses JSON object to customize the input fields.
Objects | Function |
---|---|
value | Retives all featured posts |
placeholder | Gives the input field placeholder |
class | Adds the given class |
id | Adds the given id |
style | Gives the styling |
default | Makes the mention value as default value eg like in select dropdown or checkbox |
checked | Makes the checkbox checked as default |
options | Options given for select options, radio options |
Simple Text Field Setting Customization
{
"class" : "my_class",
"id" : "my_id",
"value" : "Doctype Admin",
"placeholder" : "Site Title Here!!",
"style" : {
"color" : "red"
}
}
Simple Rich Textarea Setting Customization
{
"class" : "my_class",
"id" : "another_id",
"placeholder" : "Rich Text Placeholder",
"style" : {
"color" : "red"
}
Simple Select Field Setting Customization
{
"default" : "1",
"options" : {
"1" : "option 1",
"2" : "option 2"
}
}
Simple Radio Field Setting Customization Note type object is mandatory defining whetjer the value to be stored is integer or string type
{
"type" : "integer",
"checked" : "1",
"options" : {
"1" : "Pratik Shrestha",
"2" : "DRH2SO4"
},
"style": {
"color" : "red"
}
}
Simple Image Field Setting Customization
{
"image" : {
"fit" : {
"width" : "300",
"height" : "300"
},
"quality" : "80"
}
}
When using select and radio giving options object in customization is mandatory
- Better Confile File Control
- Maintainabilty
- More flexible customization
- Adding Exceptions
MIT
DOCTYPE NEPAL ||DR.H2SO4