Download the PHP package distilleries/expendable without Composer
On this page you can find all versions of the php package distilleries/expendable. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download distilleries/expendable
More information about distilleries/expendable
Files in distilleries/expendable
Package expendable
Short Description Expendable is an admin panel base on laravel 5.*. This package give you some implementation do add a content management system of your application. You can override everything. This Cms give view few tools to develop your content management easily and properly.
License MIT
Informations about the package expendable
Expendable
Expendable is an admin panel base on laravel 5.6.* This package give you some implementation do add a content management system of your application. You can override everything. This Cms give view few tools to develop your content management easily and properly.
Table of contents
- Require
- Installation
- Configurations
- Menu
- State
- Datatable
- Order
- Export
- Import
- Form
- Component
- Admin BaseComponent
- Admin ModelBaseController
- AdminBaseController
- Model
- Global scope
- Status
- Permissions
- Views
- Assets (CSS and Javascript)
- Sass
- Images
- Javascript
- Gulp
- Create a new backend module
- Case studies
- Generate your migration
- Generate your model
- Generate you component
- Add your controller in the routes file
- Add to the menu
Require
To use this project you have to install:
- Php 7.1.3 or more
- Active mpcrypt
- Composer https://getcomposer.org/download/
- Sass (
gem install sass
) - NodeJs version v9.4.0
Installation
Add on your composer.json
run composer update
.
Add Application override to bootstrap/app.php
:
I add a bind event to override the storage path. If you want overrid it juste add STORAGE_PATH=
on your .env. If you don't want override it juste to put it on your .env.
Add Service provider to config/app.php
:
And Facade (also in config/app.php
) replace the laravel facade Mail
Replace the service old facade Mail by the new one.
Publish the configuration:
Configurations
Field | Usage |
---|---|
login_uri | Uri to access of the login page by default admin/login . |
admin_base_uri | base of the admin uri admin by default. |
config_file_assets | File loaded to get the version number of the application. This version number is use to add it of the generated css and javascript to force the reload when you deploy your application. |
folder_whitelist | Table of folders accessible to display the assets. |
listener | Table of class autoloaded to listen a custom event. |
mail.actions | List of action available to send an email. This list is display in email module backend. |
menu | Use the method \Distilleries\Expendable\Config\MenuConfig::menu() to merge the default menu with your menu. In the table you can define left key or tasks to display in menu left or in the menu task. |
menu_left_collapsed | Set to tru to keep close the menu left. By default it set to false and the menu is open. |
state | List of state available, with the color, the logo and the name. |
Menu
I use a function to easily merge the default component with the component of the application.
By default you can find on the menu left:
- Email
- List of email
- Add email
- User
- List of user
- Add user
- Role
- List of role
- Add role
- Permission
- Associate permission
- List of service
- Add service
- Synchronize all services
- Language
- List of language
- Add language
By default you can find on the menu task:
- Generate a new component
- Synchronize all services
To add a new item it's easy
Option | Description |
---|---|
icon | Name of the icon class http://getbootstrap.com/components/#glyphicons |
action | Action call when you click ( use action helper to generate the url) |
libelle | Translation of your menu item |
submenu | If you want add sub-item you can add an array with the same options |
The method \Distilleries\Expendable\Config\MenuConfig::menu
tak two parameters
- An array with the content of the meny
['left'=>[],'tasks'=>[]]
- The second one is a string
beginning
orend
to define the direction of the merge.
Example of menu left:
Example of menu task:
State
A state is a part of your controller where you define a list of actions. By default I implemented four states:
- Datatable
- Order
- Export
- Import
- Form
To display the menu of state I provide a class for the interface Distilleries\Expendable\Contracts\StateDisplayerContract
.
This class check the interface use on your controller and with the config exependable::state
display the logo and the name of the state.
If you want change the state display, just provide a new class for the contract Distilleries\Expendable\Contracts\StateDisplayerContract
.
To display all the element I use a layout manager. you can override it to display what you want.
1. Datatable
A datatable state it's use to display a list of content with filter if you need it.
To use it you have to implement the interface Distilleries\DatatableBuilder\Contracts\DatatableStateContract
.
getIndexDatatable
it's form initilize the datatable.getDatatable
it's for get the data in json.
You can use the trait :
On this trait you have a generic implementation to display the datatable and the data. This trait need to use two attributes of your controller:
$datatable
, it's an instance ofEloquentDatatable
(come from DatatableBuilder).model
, it's and instance ofModel
(come from laravel).
Inject them on your constructor:
2. Order
Add basic order feature to a component .
Handle Controller
- must implements
\Distilleries\Expendable\Contracts\OrderStateContract
- methods are implemented in
\Distilleries\Expendable\States\OrderStateTrait
Handle Model
- must implements
\Distilleries\Expendable\Contracts\OrderContract
Methods
orderLabel()
must return a string displayed in order page (by using model attributes)orderFieldName()
must return the name of the field where the model persist the order
3. Export
An export state it's to export the data from your model between two dates.
To use it you have to implement the interface Distilleries\Expendable\Contracts\ExportStateContract
.
getExport
it's to display the form to select the dates and the type of export.postExport
proceed the export and return the file.
You can use the trait :
On this trait you have a generic implementation to export your data. This trait need to use on attribute of your controller:
model
, it's and instance ofEloquant
(come from laravel).
Inject them on your constructor:
You can change the class provide to export the data. Just add those methods on your service provider and change the class instantiated.
4. Import
An import state it's to import the data from a file to your model.
To use it you have to implement the interface Distilleries\Expendable\Contracts\ImportStateContract
.
getImport
it's to display the form give the file.postImport
proceed the import and return back.
You can use the trait :
On this trait you have a generic implementation to export your data. This trait need to use on attribute of your controller:
model
, it's and instance ofEloquant
(come from laravel).
Inject them on your constructor:
You can change the class provide to import the data. Just add those methods on your service provider and change the class instantiated.
5. Form
The form state give you a part to add or edit an element and a part to view the element without edit.
To use it you have to implement the interface Distilleries\FormBuilder\Contracts\FormStateContract
.
getEdit
it's to display the form to edit or add new item.postEdit
proceed the save or update.getView
Display the form in not editable.
You can use the trait :
On this trait you have a generic implementation to display form, save and display view. This trait need to use two attributes of your controller:
model
, it's and instance ofEloquant
(come from laravel).form
, it's and instance ofForm
(come from FormBuilder).
Inject them on your constructor:
Component
A component is just a composition of controller, form, datatable, model.
To create a new component you can go in /admin/component/edit
and fill the form, or use the command line:
You can check the options with the help.
In the backend you have all this options:
Field | Description |
---|---|
Name | The name use to generate the controllers and other classes (ex: Address, AddressController, AddressForm, AddressDatatable). |
State | The state you want use on your controller |
Model | The model inject on your controller |
Columns | List of columns display on the datatable |
Fields | The field you want in your form (name:type ex: id:hidden, libelle:text...) |
To know all the types of fields you can have look the documentation.
Admin BaseComponent
By default if you check all the state that generate a controller inheritance from Distilleries\Expendable\Http\Controllers\Admin\Base\BaseComponent
.
This controller implement all the states interfaces.
Admin ModelBaseController
If you don't want use all the state and you use a model just extend Distilleries\Expendable\Http\Controllers\Admin\Base\ModelBaseController
.
Example:
Admin BaseController
If you don't want use all the state and you don't use a model just extend Distilleries\Expendable\Http\Controllers\Admin\Base\BaseController
.
You just have to inject the LayoutManagerContract
Example:
Model
By default you can extend \Distilleries\Expendable\Models\BaseModel
, this one extend \Illuminate\Database\Eloquent\Model
.
On it you have some method you can use:
Method | Detail |
---|---|
getChoice | Return a table with in key the id and the value the libelle |
scopeSearch | Query scope to search in all columns |
getAllColumnsNames | Get all the columns of your table |
scopeBetweenCreate | Query scope to get all the element between to date by the field created_at |
scopeBetweenupdate | Query scope to get all the element between to date by the field created_at |
Global scope
I provide some global scope usable on the model.
Status
If you want display an element only if your are connected use this scope. The model check if the user is not connected and if the status equal online (1).
To use it add the trait on your model use \Distilleries\Expendable\Models\StatusTrait;
Permissions
The system of permission is base on the public method of all your controller.
To generate the list of all services use the Synchronize all services
(/admin/service/synchronize
).
That use all the controller and get the public actions.
If you go on Associate Permission
you have the list of controller with all methods:
On this page you can allow a role to the method.
By default Expendable use Distilleries\PermissionUtil
package and add the good middleware in his kernel.
You don't have to configure something.
If the role is not allowed the application dispatch an error 403:
Views
To override the view publish them with command line:
Assets (CSS and Javascript)
All the assets are one the folder resources/assets
.
Sass
To use the sass file just add bootstrap and application.admin.scss
on your admin file scss.
If you check the repo Xyz you have a folder assets.
I use the same structure.
Images
The images are copy by mix script when they are found in sass file
Javascript
The javascript is compiled by the mix
Composer
I update my composer json to add the npm install and gulp generation when I update my libraries.
Create a new backend module
- Generate your migration.
- Generate your model.
- Generate you component.
- Add your controller in the routes file.
Case studies
Try to create a blog post component. I use a fresh install of Xyz
1. Generate your migration
2. Generate your model
3 Generate you component
I use the backend generator /admin/component/edit
.
Datatable:
Form:
This file is generated:
You have to update it for give a value for the choice and give the rules for the validation:
Controller:
4 Add your controller in the routes file
I add Route::controller('post', 'Admin\PostController');
on the route file:
5 Add to the menu
On config/expendable.php
id add the Post entry:
All versions of expendable with dependencies
illuminate/support Version 5.8.*
illuminate/database Version 5.8.*
illuminate/translation Version 5.8.*
distilleries/datatable-builder Version 2.14.*
distilleries/form-builder Version 2.13.*
distilleries/permission-util Version 1.10.*
distilleries/security Version 1.1.*
forxer/gravatar Version ~1.2
maatwebsite/excel Version 3.1.*